{"id":22080554,"url":"https://github.com/electronic-mango/reddit-python-api","last_synced_at":"2026-02-05T12:33:22.082Z","repository":{"id":206959290,"uuid":"718100770","full_name":"Electronic-Mango/reddit-python-api","owner":"Electronic-Mango","description":"Simple Reddit Python API / Reddit API wrapper.","archived":false,"fork":false,"pushed_at":"2024-06-15T15:30:05.000Z","size":2921,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-24T23:19:43.263Z","etag":null,"topics":["python","python3","reddit","reddit-api","reddit-api-wrapper"],"latest_commit_sha":null,"homepage":"https://electronic-mango.github.io/reddit-python-api/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Electronic-Mango.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-13T11:35:04.000Z","updated_at":"2024-06-15T15:29:36.000Z","dependencies_parsed_at":"2023-11-16T10:25:56.289Z","dependency_job_id":"3c3f8bc2-bc3c-4e30-b930-9e61b23f0043","html_url":"https://github.com/Electronic-Mango/reddit-python-api","commit_stats":null,"previous_names":["electronic-mango/reddit-python-api"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/Electronic-Mango/reddit-python-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Electronic-Mango%2Freddit-python-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Electronic-Mango%2Freddit-python-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Electronic-Mango%2Freddit-python-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Electronic-Mango%2Freddit-python-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Electronic-Mango","download_url":"https://codeload.github.com/Electronic-Mango/reddit-python-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Electronic-Mango%2Freddit-python-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29121775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T10:47:47.471Z","status":"ssl_error","status_checked_at":"2026-02-05T10:45:08.119Z","response_time":65,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","python3","reddit","reddit-api","reddit-api-wrapper"],"created_at":"2024-11-30T23:15:39.339Z","updated_at":"2026-02-05T12:33:22.063Z","avatar_url":"https://github.com/Electronic-Mango.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Reddit Python API\n\n[![CodeQL](https://github.com/Electronic-Mango/reddit-python-api/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/Electronic-Mango/reddit-python-api/actions/workflows/codeql-analysis.yml)\n[![Black](https://github.com/Electronic-Mango/reddit-python-api/actions/workflows/black.yml/badge.svg)](https://github.com/Electronic-Mango/reddit-python-api/actions/workflows/black.yml)\n[![Flake8](https://github.com/Electronic-Mango/reddit-python-api/actions/workflows/flake8.yml/badge.svg)](https://github.com/Electronic-Mango/reddit-python-api/actions/workflows/flake8.yml)\n[![isort](https://github.com/Electronic-Mango/reddit-python-api/actions/workflows/isort.yml/badge.svg)](https://github.com/Electronic-Mango/reddit-python-api/actions/workflows/isort.yml)\n[![PyPI - Version](https://img.shields.io/pypi/v/reddit-python-api)](https://pypi.org/project/reddit-python-api/)\n\n\nA simple unofficial read-only Reddit Python API allowing access to both subreddit and user articles, build with [`httpx`](https://www.python-httpx.org/).\n\n\n\n## Table of contents\n\n  * [Introduction and requirements](#introduction-and-requirements)\n  * [Installation](#installation)\n  * [Reddit app \u0026 configuration](#reddit-app--configuration)\n  * [Usage](#usage)\n    * [Create the API](#create-the-api)\n    * [Get a list of articles in a subreddit](#get-a-list-of-articles-in-a-subreddit)\n    * [Get a list of user articles](#get-a-list-of-user-articles)\n    * [Returned articles type](#returned-articles-type)\n  * [Disclaimer](#disclaimer)\n\n\n\n## Introduction and requirements\n\nThis Python API was built using [`httpx`](https://www.python-httpx.org/) and `Python 3.10`.\nPython version at least `3.10` is required.\n\nFull list of Python requirements is in `requirements.txt` file.\n\nNo additional API wrapper was used (like [PRAW](https://github.com/praw-dev/praw)), Reddit API is accessed directly.\nIt should be much faster when accessing a list of articles.\n\nNo data is stored.\n**Reddit is accessed in `read-only` mode.**\n\n\nCurrently, this API allows access to articles in either subreddits or from users.\nIt doesn't access comments.\n\n\n\n## Installation\n\nProject is available in [PyPi](https://pypi.org/project/reddit-python-api/):\n```bash\npip install reddit-python-api\n```\n\n\n\n## Reddit app \u0026 configuration\n\nIn order to use this API you need to create a Reddit app at https://old.reddit.com/prefs/apps/.\nTwo parameters are required `client id` and `secret` from your app.\nThose values will be used to acquire OAuth 2.0 token from Reddit API itself. \n\nNo other data is necessary, since the API works in `read-only` mode.\n\nWhen creating the API you can also specify user agent used for communication with Reddit API.\nBy default `Reddit Python API (by Electronic-Mango on GitHub)` is used.\nReddit required a meaningful user agent to be provided by apps.\n\n\n\n## Usage\n\n### Create the API\n\nTwo parameters are required - app id and secret:\n```python\nfrom redditpythonapi import Reddit\n\nreddit = Reddit(\"your client ID\", \"your app secret\") \n```\n\nYou can also specify user-agent:\n```python\nfrom redditpythonapi import Reddit\n\nreddit = Reddit(\"your client ID\", \"your app secret\", \"custom user agent\") \n```\n\n\n### Get a list of articles in a subreddit\n\n```python\nreddit = Reddit(\"your client ID\", \"your app secret\")\n# reddit.subreddit_articles(\"subreddit name\", load_count, sort_type)\narticles = reddit.subreddit_articles(\"Python\", ArticlesSortType.HOT, ArticlesSortTime.WEEK, 10)\n```\nFirst argument is a name of a subreddit.\n**This is the only required argument.**\n\nSecond argument specifies sort type.\nFollowing sort types are supported:\n```python\nArticlesSortType.HOT\nArticlesSortType.NEW\nArticlesSortType.RISING\nArticlesSortType.TOP\nArticlesSortType.CONTROVERSIAL\n```\n\nThird argument specifies sort time.\nFollowing values are supported:\n```python\nArticlesSortType.HOUR\nArticlesSortType.DAY\nArticlesSortType.WEEK\nArticlesSortType.MONTH\nArticlesSortType.YEAR\nArticlesSortType.ALL\n```\n\nFourth argument specifies how many articles should be loaded.\nAPI can return lower number if there are fewer articles in a given subreddit than provided.\n\nLoad count, sort type and sort time are optional.\nDefault sort type for **subreddits** is `hot`.\nFor other values if they are not specified, then they are not passed onto Reddit API at all.\n\n\n### Get a list of user articles\n\n```python\nreddit = Reddit(\"your client ID\", \"your app secret\")\n# reddit.user_articles(\"username\", load_count, sort_type)\narticles = reddit.user_articles(\"spez\", ArticlesSortType.CONTROVERSIAL, ArticlesSortTime.ALL, 20)\n```\nFirst argument is a username.\n**This is the only required argument.**\n\nGeneral usage is the same as for subreddits.\n\n\n### Returned articles type\n\nReturned type is a list of articles, where each article is a `Article`.\n`Article` is just an alias to `dict[str, Any]`.\nReturned data is directly representing JSON returned by official Reddit API, there are no modification to responses.\n\nYou can check official Reddit API documentation for:\n * users - https://www.reddit.com/dev/api/#GET_user_{username}_submitted\n * subreddits - https://www.reddit.com/dev/api/#GET_hot (and other endpoints for different sort types)\n\nReturned dicts are [`listings`](https://www.reddit.com/dev/api/#listings) directly from official Reddit API.\nArticle contents are quite long, but I've left their additional parsing the user.\nHere is an example of one article dict:\n```python\n{\n    'approved_at_utc': None,\n    'subreddit': 'wow',\n    'selftext': 'https://youtu.be/IHZru-6M8BY\\n\\nJason Hall, currently an indie developer and former Blizzard employee said in one of his videos\\n\\n\u0026gt;A $15 microtransaction horse made more money than StarCraft 2\\n\\nHe worked two years of overtime on StarCraft 2: Wings of Liberty. And the entire game ended up making less money for Blizzard than a single mount in World of Warcraft.',\n    'author_fullname': 't2_gnuby',\n    'saved': False,\n    'mod_reason_title': None,\n    'gilded': 0,\n    'clicked': False,\n    'title': '$15 horse for WoW made more money than StarCraft 2: Wings of Liberty',\n    'link_flair_richtext': [\n        {\n            'e': 'text',\n            't': 'Discussion'\n        }\n    ],\n    'subreddit_name_prefixed': 'r/wow',\n    'hidden': False,\n    'pwls': 6,\n    'link_flair_css_class': 'discussion',\n    'downs': 0,\n    'thumbnail_height': None,\n    'top_awarded_type': None,\n    'hide_score': False,\n    'name': 't3_17tpwfa',\n    'quarantine': False,\n    'link_flair_text_color': 'dark',\n    'upvote_ratio': 0.94,\n    'author_flair_background_color': None,\n    'subreddit_type': 'public',\n    'ups': 2303,\n    'total_awards_received': 0,\n    'media_embed': {\n        \n    },\n    'thumbnail_width': None,\n    'author_flair_template_id': None,\n    'is_original_content': False,\n    'user_reports': [\n        \n    ],\n    'secure_media': None,\n    'is_reddit_media_domain': False,\n    'is_meta': False,\n    'category': None,\n    'secure_media_embed': {\n        \n    },\n    'link_flair_text': 'Discussion',\n    'can_mod_post': False,\n    'score': 2303,\n    'approved_by': None,\n    'is_created_from_ads_ui': False,\n    'author_premium': False,\n    'thumbnail': 'self',\n    'edited': False,\n    'author_flair_css_class': None,\n    'author_flair_richtext': [\n        \n    ],\n    'gildings': {\n        \n    },\n    'post_hint': 'self',\n    'content_categories': None,\n    'is_self': True,\n    'mod_note': None,\n    'created': 1699812579.0,\n    'link_flair_type': 'richtext',\n    'wls': 6,\n    'removed_by_category': None,\n    'banned_by': None,\n    'author_flair_type': 'text',\n    'domain': 'self.wow',\n    'allow_live_comments': True,\n    'selftext_html': '\u0026lt;!-- SC_OFF --\u0026gt;\u0026lt;div class=\"md\"\u0026gt;\u0026lt;p\u0026gt;\u0026lt;a href=\"https://youtu.be/IHZru-6M8BY\"\u0026gt;https://youtu.be/IHZru-6M8BY\u0026lt;/a\u0026gt;\u0026lt;/p\u0026gt;\\n\\n\u0026lt;p\u0026gt;Jason Hall, currently an indie developer and former Blizzard employee said in one of his videos\u0026lt;/p\u0026gt;\\n\\n\u0026lt;blockquote\u0026gt;\\n\u0026lt;p\u0026gt;A $15 microtransaction horse made more money than StarCraft 2\u0026lt;/p\u0026gt;\\n\u0026lt;/blockquote\u0026gt;\\n\\n\u0026lt;p\u0026gt;He worked two years of overtime on StarCraft 2: Wings of Liberty. And the entire game ended up making less money for Blizzard than a single mount in World of Warcraft.\u0026lt;/p\u0026gt;\\n\u0026lt;/div\u0026gt;\u0026lt;!-- SC_ON --\u0026gt;',\n    'likes': None,\n    'suggested_sort': None,\n    'banned_at_utc': None,\n    'view_count': None,\n    'archived': False,\n    'no_follow': False,\n    'is_crosspostable': False,\n    'pinned': False,\n    'over_18': False,\n    'preview': {\n        'images': [\n            {\n                'source': {\n                    'url': 'https://external-preview.redd.it/aTydt70E_WWF4CDra361TKJGXyuZfwQ_WUkymcp6gW8.jpg?auto=webp\u0026amp;s=22796fd51cff670774bfdc6c30fcc5681afaaab6',\n                    'width': 480,\n                    'height': 360\n                },\n                'resolutions': [\n                    {\n                        'url': 'https://external-preview.redd.it/aTydt70E_WWF4CDra361TKJGXyuZfwQ_WUkymcp6gW8.jpg?width=108\u0026amp;crop=smart\u0026amp;auto=webp\u0026amp;s=6038c06ccc24cd82791506a765b92a96c4481a7d',\n                        'width': 108,\n                        'height': 81\n                    },\n                    {\n                        'url': 'https://external-preview.redd.it/aTydt70E_WWF4CDra361TKJGXyuZfwQ_WUkymcp6gW8.jpg?width=216\u0026amp;crop=smart\u0026amp;auto=webp\u0026amp;s=1b6308d7254313e680e6f8a995fe2ebe11c667a7',\n                        'width': 216,\n                        'height': 162\n                    },\n                    {\n                        'url': 'https://external-preview.redd.it/aTydt70E_WWF4CDra361TKJGXyuZfwQ_WUkymcp6gW8.jpg?width=320\u0026amp;crop=smart\u0026amp;auto=webp\u0026amp;s=afb31085dde1286d636a2bdff992cdfccf744653',\n                        'width': 320,\n                        'height': 240\n                    }\n                ],\n                'variants': {\n                    \n                },\n                'id': 'aqHslU2jfEu8nGDHD1GfMh4aADRzrHE6jlApmtUPZYU'\n            }\n        ],\n        'enabled': False\n    },\n    'all_awardings': [\n        \n    ],\n    'awarders': [\n        \n    ],\n    'media_only': False,\n    'link_flair_template_id': 'ad4fefe2-494b-11ea-9fda-0ecf49ab1e6d',\n    'can_gild': False,\n    'spoiler': False,\n    'locked': False,\n    'author_flair_text': None,\n    'treatment_tags': [\n        \n    ],\n    'visited': False,\n    'removed_by': None,\n    'num_reports': None,\n    'distinguished': None,\n    'subreddit_id': 't5_2qio8',\n    'author_is_blocked': False,\n    'mod_reason_by': None,\n    'removal_reason': None,\n    'link_flair_background_color': '',\n    'id': '17tpwfa',\n    'is_robot_indexable': True,\n    'report_reasons': None,\n    'author': 'ErgoNonSim',\n    'discussion_type': None,\n    'num_comments': 563,\n    'send_replies': False,\n    'whitelist_status': 'all_ads',\n    'contest_mode': False,\n    'mod_reports': [\n        \n    ],\n    'author_patreon_flair': False,\n    'author_flair_text_color': None,\n    'permalink': '/r/wow/comments/17tpwfa/15_horse_for_wow_made_more_money_than_starcraft_2/',\n    'parent_whitelist_status': 'all_ads',\n    'stickied': False,\n    'url': 'https://www.reddit.com/r/wow/comments/17tpwfa/15_horse_for_wow_made_more_money_than_starcraft_2/',\n    'subreddit_subscribers': 2427761,\n    'created_utc': 1699812579.0,\n    'num_crossposts': 2,\n    'media': None,\n    'is_video': False\n}\n```\n\n\n\n## Disclaimer\n\nThis API is in no way affiliated, associated, authorized, endorsed by, or in any way officially connected with Reddit.\nThis is an independent and unofficial project.\nUse at your own risk.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectronic-mango%2Freddit-python-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felectronic-mango%2Freddit-python-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectronic-mango%2Freddit-python-api/lists"}