RedditSearchAPIWrapper#
- class langchain_community.utilities.reddit_search.RedditSearchAPIWrapper[source]#
Bases:
BaseModel
Wrapper for Reddit API
To use, set the environment variables
REDDIT_CLIENT_ID
,REDDIT_CLIENT_SECRET
,REDDIT_USER_AGENT
to set the client ID, client secret, and user agent, respectively, as given by Redditβs API. Alternatively, all three can be supplied as named parameters in the constructor:reddit_client_id
,reddit_client_secret
, andreddit_user_agent
, respectively.Example
from langchain_community.utilities import RedditSearchAPIWrapper reddit_search = RedditSearchAPIWrapper()
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- param reddit_client: Any = None#
- param reddit_client_id: str | None = None#
- param reddit_client_secret: str | None = None#
- param reddit_user_agent: str | None = None#
- results(query: str, sort: str, time_filter: str, subreddit: str, limit: int) List[Dict] [source]#
Use praw to search Reddit and return a list of dictionaries, one for each post.
- Parameters:
query (str) β
sort (str) β
time_filter (str) β
subreddit (str) β
limit (int) β
- Return type:
List[Dict]
Examples using RedditSearchAPIWrapper