diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-redditeasy.spec | 525 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 527 insertions, 0 deletions
@@ -0,0 +1 @@ +/redditeasy-4.0.0.tar.gz diff --git a/python-redditeasy.spec b/python-redditeasy.spec new file mode 100644 index 0000000..674c3ab --- /dev/null +++ b/python-redditeasy.spec @@ -0,0 +1,525 @@ +%global _empty_manifest_terminate_build 0 +Name: python-redditeasy +Version: 4.0.0 +Release: 1 +Summary: RedditEasy is an API wrapper for getting posts using the Reddit JSON API with both sync and async options +License: GNU General Public License v3 (GPLv3) +URL: https://redditeasy.readthedocs.io/en/latest/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/16/78/366aba54f6abf71981050c2a206254373b3f38b87ea7e88773c6874c8057/redditeasy-4.0.0.tar.gz +BuildArch: noarch + +Requires: python3-aiohttp +Requires: python3-urllib3 +Requires: python3-orjson + +%description +[](https://redditeasy.readthedocs.io/en/latest/?badge=latest) +[](LICENSE) +[](https://github.com/ExpDev07/coronavirus-tracker-api/stargazers) +[](https://badge.fury.io/py/redditeasy) +[](https://badge.fury.io/py/redditeasy) +[](https://www.codacy.com/gh/MakufonSkifto/RedditEasy/dashboard?utm_source=github.com&utm_medium=referral&utm_content=MakufonSkifto/RedditEasy&utm_campaign=Badge_Grade) +[](https://img.shields.io/badge/Python-3%20%7C%203.5%20%7C%203.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-blue.svg) +# RedditEasy + +RedditEasy is a rapidly-fast API wrapper for getting posts using the Reddit JSON API with both sync and async options + +## Install +To install RedditEasy, do: + +``pip install redditeasy`` + +OR + +``python -m pip install redditeasy`` + +OR (not recommended) + +``pip install git+https://github.com/MakufonSkifto/RedditEasy.git`` + +## Documentation +Docs can be found [here](https://redditeasy.readthedocs.io/en/latest/) + +## Async RedditEasy +Yes, there is an async version of RedditEasy. To use it, you need to use the Async classes. Which are `AsyncSubreddit` and `AsyncUser` + +Here is a small example on using `AsyncSubreddit`: https://github.com/MakufonSkifto/RedditEasy/blob/main/examples/async_meme.py + +You can and should use this in a discord.py bot. The normal classes could cause a [blocking](https://discordpy.readthedocs.io/en/latest/faq.html#what-does-blocking-mean) in an async program. + +This **will not** work outside an async function whatsoever. + +## Usage + +### Without Reddit API client info +This method is not suggested as it may be slow and throw errors more often + +```python +import redditeasy +import datetime + +# 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.png + + +post = redditeasy.Subreddit() + +postoutput = post.get_post(subreddit="dankmemes") # Subreddit name + +# Formatted version of created_at +formatted_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 info + +```python +import redditeasy +import datetime + +# 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.png + + +post = redditeasy.Subreddit(client_id="", # Your client ID + client_secret="", # Your client secret + user_agent="" # Your user agent (ex: ClientName/0.1 by YourUsername") + ) + +postoutput = post.get_post(subreddit="dankmemes") # Subreddit name + +# Formatted version of created_at +formatted_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 the [examples folder](https://github.com/MakufonSkifto/RedditEasy/tree/main/examples) + +## Getting Reddit API client info +To get your Reddit API client info go to +https://www.reddit.com/prefs/apps +and create a script. + + + +(You don't have to fill "redirect_uri") + +## Changelog + +Changelog can be found [here](https://redditeasy.readthedocs.io/en/latest/changelog.html) + +## Operating Systems + +All of RedditEasy's versions were tested in `Windows`, `Linux (Ubuntu)` and `MacOS` + +## Errors + +The module will raise `redditeasy.exceptions.RequestError` if there was an error with the request. Traceback will show the details about the error + +The module will raise `redditeasy.exceptions.EmptyResult` if the given user / subreddit is empty + +## Issues + +If you have any issues with RedditEasy, please report them via the [issue tracker](https://github.com/MakufonSkifto/RedditEasy/issues) + + + + +%package -n python3-redditeasy +Summary: RedditEasy is an API wrapper for getting posts using the Reddit JSON API with both sync and async options +Provides: python-redditeasy +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-redditeasy +[](https://redditeasy.readthedocs.io/en/latest/?badge=latest) +[](LICENSE) +[](https://github.com/ExpDev07/coronavirus-tracker-api/stargazers) +[](https://badge.fury.io/py/redditeasy) +[](https://badge.fury.io/py/redditeasy) +[](https://www.codacy.com/gh/MakufonSkifto/RedditEasy/dashboard?utm_source=github.com&utm_medium=referral&utm_content=MakufonSkifto/RedditEasy&utm_campaign=Badge_Grade) +[](https://img.shields.io/badge/Python-3%20%7C%203.5%20%7C%203.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-blue.svg) +# RedditEasy + +RedditEasy is a rapidly-fast API wrapper for getting posts using the Reddit JSON API with both sync and async options + +## Install +To install RedditEasy, do: + +``pip install redditeasy`` + +OR + +``python -m pip install redditeasy`` + +OR (not recommended) + +``pip install git+https://github.com/MakufonSkifto/RedditEasy.git`` + +## Documentation +Docs can be found [here](https://redditeasy.readthedocs.io/en/latest/) + +## Async RedditEasy +Yes, there is an async version of RedditEasy. To use it, you need to use the Async classes. Which are `AsyncSubreddit` and `AsyncUser` + +Here is a small example on using `AsyncSubreddit`: https://github.com/MakufonSkifto/RedditEasy/blob/main/examples/async_meme.py + +You can and should use this in a discord.py bot. The normal classes could cause a [blocking](https://discordpy.readthedocs.io/en/latest/faq.html#what-does-blocking-mean) in an async program. + +This **will not** work outside an async function whatsoever. + +## Usage + +### Without Reddit API client info +This method is not suggested as it may be slow and throw errors more often + +```python +import redditeasy +import datetime + +# 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.png + + +post = redditeasy.Subreddit() + +postoutput = post.get_post(subreddit="dankmemes") # Subreddit name + +# Formatted version of created_at +formatted_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 info + +```python +import redditeasy +import datetime + +# 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.png + + +post = redditeasy.Subreddit(client_id="", # Your client ID + client_secret="", # Your client secret + user_agent="" # Your user agent (ex: ClientName/0.1 by YourUsername") + ) + +postoutput = post.get_post(subreddit="dankmemes") # Subreddit name + +# Formatted version of created_at +formatted_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 the [examples folder](https://github.com/MakufonSkifto/RedditEasy/tree/main/examples) + +## Getting Reddit API client info +To get your Reddit API client info go to +https://www.reddit.com/prefs/apps +and create a script. + + + +(You don't have to fill "redirect_uri") + +## Changelog + +Changelog can be found [here](https://redditeasy.readthedocs.io/en/latest/changelog.html) + +## Operating Systems + +All of RedditEasy's versions were tested in `Windows`, `Linux (Ubuntu)` and `MacOS` + +## Errors + +The module will raise `redditeasy.exceptions.RequestError` if there was an error with the request. Traceback will show the details about the error + +The module will raise `redditeasy.exceptions.EmptyResult` if the given user / subreddit is empty + +## Issues + +If you have any issues with RedditEasy, please report them via the [issue tracker](https://github.com/MakufonSkifto/RedditEasy/issues) + + + + +%package help +Summary: Development documents and examples for redditeasy +Provides: python3-redditeasy-doc +%description help +[](https://redditeasy.readthedocs.io/en/latest/?badge=latest) +[](LICENSE) +[](https://github.com/ExpDev07/coronavirus-tracker-api/stargazers) +[](https://badge.fury.io/py/redditeasy) +[](https://badge.fury.io/py/redditeasy) +[](https://www.codacy.com/gh/MakufonSkifto/RedditEasy/dashboard?utm_source=github.com&utm_medium=referral&utm_content=MakufonSkifto/RedditEasy&utm_campaign=Badge_Grade) +[](https://img.shields.io/badge/Python-3%20%7C%203.5%20%7C%203.6%20%7C%203.7%20%7C%203.8%20%7C%203.9-blue.svg) +# RedditEasy + +RedditEasy is a rapidly-fast API wrapper for getting posts using the Reddit JSON API with both sync and async options + +## Install +To install RedditEasy, do: + +``pip install redditeasy`` + +OR + +``python -m pip install redditeasy`` + +OR (not recommended) + +``pip install git+https://github.com/MakufonSkifto/RedditEasy.git`` + +## Documentation +Docs can be found [here](https://redditeasy.readthedocs.io/en/latest/) + +## Async RedditEasy +Yes, there is an async version of RedditEasy. To use it, you need to use the Async classes. Which are `AsyncSubreddit` and `AsyncUser` + +Here is a small example on using `AsyncSubreddit`: https://github.com/MakufonSkifto/RedditEasy/blob/main/examples/async_meme.py + +You can and should use this in a discord.py bot. The normal classes could cause a [blocking](https://discordpy.readthedocs.io/en/latest/faq.html#what-does-blocking-mean) in an async program. + +This **will not** work outside an async function whatsoever. + +## Usage + +### Without Reddit API client info +This method is not suggested as it may be slow and throw errors more often + +```python +import redditeasy +import datetime + +# 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.png + + +post = redditeasy.Subreddit() + +postoutput = post.get_post(subreddit="dankmemes") # Subreddit name + +# Formatted version of created_at +formatted_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 info + +```python +import redditeasy +import datetime + +# 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.png + + +post = redditeasy.Subreddit(client_id="", # Your client ID + client_secret="", # Your client secret + user_agent="" # Your user agent (ex: ClientName/0.1 by YourUsername") + ) + +postoutput = post.get_post(subreddit="dankmemes") # Subreddit name + +# Formatted version of created_at +formatted_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 the [examples folder](https://github.com/MakufonSkifto/RedditEasy/tree/main/examples) + +## Getting Reddit API client info +To get your Reddit API client info go to +https://www.reddit.com/prefs/apps +and create a script. + + + +(You don't have to fill "redirect_uri") + +## Changelog + +Changelog can be found [here](https://redditeasy.readthedocs.io/en/latest/changelog.html) + +## Operating Systems + +All of RedditEasy's versions were tested in `Windows`, `Linux (Ubuntu)` and `MacOS` + +## Errors + +The module will raise `redditeasy.exceptions.RequestError` if there was an error with the request. Traceback will show the details about the error + +The module will raise `redditeasy.exceptions.EmptyResult` if the given user / subreddit is empty + +## Issues + +If you have any issues with RedditEasy, please report them via the [issue tracker](https://github.com/MakufonSkifto/RedditEasy/issues) + + + + +%prep +%autosetup -n redditeasy-4.0.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-redditeasy -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 4.0.0-1 +- Package Spec generated @@ -0,0 +1 @@ +1df44f1f5350e162d2e4dd9dfabadce8 redditeasy-4.0.0.tar.gz |