Package: redditeasy
RedditEasyRedditEasy is a rapidly-fast API wrapper for getting posts using the Reddit JSON API with both sync and async optionsInstallTo install RedditEasy, do:pip install redditeasyORpython -m pip install redditeasyOR (not recommended)pip install git+https://github.com/MakufonSkifto/RedditEasy.gitDocumentationDocs can be foundhereAsync RedditEasyYes, there is an async version of RedditEasy. To use it, you need to use the Async classes. Which areAsyncSubredditandAsyncUserHere is a small example on usingAsyncSubreddit:https://github.com/MakufonSkifto/RedditEasy/blob/main/examples/async_meme.pyYou can and should use this in a discord.py bot. The normal classes could cause ablockingin an async program.Thiswill notwork outside an async function whatsoever.UsageWithout Reddit API client infoThis method is not suggested as it may be slow and throw errors more oftenimportredditeasyimportdatetime# To get your Reddit API client info go to# https://www.reddit.com/prefs/apps# and create an app# For more detailed explanation, see this image: https://i.imgur.com/Ri13AQu.pngpost=redditeasy.Subreddit()postoutput=post.get_post(subreddit="dankmemes")# Subreddit name# Formatted version of created_atformatted_time=datetime.datetime.fromtimestamp(postoutput.created_at).strftime("%d/%m/%Y %I:%M:%S UTC")print(f"Posts Title:{postoutput.title}\n"f"Posts Content:{postoutput.content}\n"f"Posts Author: u/{postoutput.author}\n"f"Posts URL:{postoutput.post_url}\n"f"Spoiler?:{postoutput.spoiler}\n"f"Post Created At:{formatted_time}\n"f"Posts Upvote Count:{postoutput.score}\n"f"Posts Award Count:{postoutput.total_awards}\n"f"NSFW?:{postoutput.nsfw}\n"f"Post Flair:{postoutput.post_flair}\n"f"User Flair:{postoutput.author_flair}\n"f"Subreddit Subscribers:{postoutput.subreddit_subscribers}\n"f"Comment count:{postoutput.comment_count}\n"f"Is Media?:{postoutput.is_media}\n"f"Subreddit Name: r/{postoutput.subreddit_name}\n"f"Content Type:{postoutput.content_type}")With Reddit API client infoimportredditeasyimportdatetime# To get your Reddit API client info go to# https://www.reddit.com/prefs/apps# and create an app# For more detailed explanation, see this image: https://i.imgur.com/Ri13AQu.pngpost=redditeasy.Subreddit(client_id="",# Your client IDclient_secret="",# Your client secretuser_agent=""# Your user agent (ex: ClientName/0.1 by YourUsername"))postoutput=post.get_post(subreddit="dankmemes")# Subreddit name# Formatted version of created_atformatted_time=datetime.datetime.fromtimestamp(postoutput.created_at).strftime("%d/%m/%Y %I:%M:%S UTC")print(f"Posts Title:{postoutput.title}\n"f"Posts Content:{postoutput.content}\n"f"Posts Author: u/{postoutput.author}\n"f"Posts URL:{postoutput.post_url}\n"f"Spoiler?:{postoutput.spoiler}\n"f"Post Created At:{formatted_time}\n"f"Posts Upvote Count:{postoutput.score}\n"f"Posts Award Count:{postoutput.total_awards}\n"f"NSFW?:{postoutput.nsfw}\n"f"Post Flair:{postoutput.post_flair}\n"f"User Flair:{postoutput.author_flair}\n"f"Subreddit Subscribers:{postoutput.subreddit_subscribers}\n"f"Comment count:{postoutput.comment_count}\n"f"Is Media?:{postoutput.is_media}\n"f"Subreddit Name: r/{postoutput.subreddit_name}\n"f"Content Type:{postoutput.content_type}")More examples are in theexamples folderGetting Reddit API client infoTo get your Reddit API client info go tohttps://www.reddit.com/prefs/appsand create a script.(You don't have to fill "redirect_uri")ChangelogChangelog can be foundhereOperating SystemsAll of RedditEasy's versions were tested inWindows,Linux (Ubuntu)andMacOSErrorsThe module will raiseredditeasy.exceptions.RequestErrorif there was an error with the request. Traceback will show the details about the errorThe module will raiseredditeasy.exceptions.EmptyResultif the given user / subreddit is emptyIssuesIf you have any issues with RedditEasy, please report them via theissue tracker