Reddit Abstract Models¶
Class Reference¶
-
class
Reddit.
RedditPost
(self, subreddit: str=None, id: str=None, created_utc: float=None, title: str=None, url: str=None, permalink: str=None, author: str=None, **kwargs)¶ Helper object to represent a Reddit Submission
Note
To simplify construction from Reddit’s JSON return, additional keyword arguments are accepted but discarded
-
subreddit
(str)¶ Submission subreddit
-
created_utc
(datetime)¶ Post creation date (UTC)
-
title
(str)¶ Submission title
-
url
(yarl.URL)¶ Content URL
-
permalink
(yarl.URL)¶ Submission permalink
Submission author
-
static
fromJSON
(inJSON: dict) → RedditPost¶ Generate
Reddit.RedditPost
from a Reddit submission JSON (as dict)
-
static
fromPRAW
(inSub: praw.Submission) → RedditPost¶ Generate
Reddit.RedditPost
from apraw.Submission
object
-
-
class
RedditPRAW
(credentialJSON: Path=Path('./credentials.JSON'))¶ Helper class for PRAW instance
Note
On instantiation, an attempt is made to authenticate using the input
credentialJSON
credentialJSON
should contain a'RedditOAuth'
key with an(ID, secret)
tupleThe
isauthenticated
attribute can be queried to determine authentication status-
getnewusersubmissions
(self, username: str, limit: int=25) → praw.models.ListingGenerator¶ Return a
praw.ListingGenerator
ofusername
’s newest Reddit submissionsAPI call can be limited to a number of submissions, as specified by
limit
-
-
class
RedditJSON
¶ Helper class for Reddit JSON methods
-
staticmethod coroutine
asyncfromJSON
(jsonURL: typing.Union[str, URL]=None, skipvalidation: bool=False) → typing.List:¶ Return a list of
Reddit.RedditPost
objects from an input Reddit JSON URLSupported URL schemas are:
https://old.reddit.com/u(ser)/username/submitted(/).json https://old.reddit.com/r/subreddit(/).json https://old.reddit.com/r/subreddit/comments/*.json
Other input URL formats are not supported
The skipvalidation flag allows you to skip the URL validation if it has already been validated
-
static
fromJSON
(jsonURL: typing.Union[str, URL]=None, skipvalidation: bool=False) → typing.List:¶ This function is blocking
Return a list of
Reddit.RedditPost
objects from an input Reddit JSON URLSupported URL schemas are:
https://old.reddit.com/u(ser)/username/submitted(/).json https://old.reddit.com/r/subreddit(/).json https://old.reddit.com/r/subreddit/comments/*.json
Other input URL formats are not supported
The skipvalidation flag allows you to skip the URL validation if it has already been validated
-
staticmethod coroutine
asyncfromURL
(inURL: typing.Union[str, yarl.URL]=None) → typing.List:¶ Return a list of
reddit.RedditPost
objects from an input Reddit URLSupported URL schemas are:
https://old.reddit.com/u(ser)/username/submitted(/) https://old.reddit.com/r/subreddit(/) https://old.reddit.com/r/subreddit/comments/*
Other input URL formats are not supported
-
static
fromURL
(inURL: typing.Union[str, yarl.URL]=None) → typing.List:¶ This function is blocking
Return a list of
reddit.RedditPost
objects from an input Reddit URLSupported URL schemas are:
https://old.reddit.com/u(ser)/username/submitted(/) https://old.reddit.com/r/subreddit(/) https://old.reddit.com/r/subreddit/comments/*
Other input URL formats are not supported
-
staticmethod coroutine