Skip to main content

Reddit API

Project description

Installation

pip install reddit-api-client

Examples

Guest Endpoints

from reddit.scraper import Scraper

reddit = Scraper()

homepage = reddit.homepage()

popular = reddit.popular()

front_page = reddit.front_page()

subreddit = reddit.subreddit("pics")

search = reddit.search(
    'api blackout',
    includePosts=True,
    includeCommunities=True,
    includeAuthors=True,
    includeComments=True,
    # communitySearch=False,
    # customFeedSearch=False,
    # postsAfter=None,
    # communitiesAfter=None,
    # authorsAfter=None,
    # commentsAfter=None,
    filters={
        'nsfw': '0',  # {'1', '0'},
        'time_range': 'null',  # {'hour', 'day', 'week', 'month', 'year', 'null'},
        'post_types': 'null',  # {'gif', 'image', 'link', 'poll', 'text', 'video', 'null'},
        'result_types': '',  # {'subreddit', 'profile', ''}
    },
    sort='NEW',  # {'RELEVANCE', 'HOT', 'TOP', 'NEW', 'COMMENTS'}
)

Auth Endpoints

from reddit.scraper import Scraper

username, password = ..., ...
reddit = Scraper(username, password)

# get data from posts
posts = reddit.posts({
    'pics': ['147p5ql', '146zsax'],
    'funny': '143wysp',
})

# comment on a post
reddit.comment('146zsax', 'test 123')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reddit-api-client-0.0.0.tar.gz (26.3 kB view hashes)

Uploaded Source

Built Distribution

reddit_api_client-0.0.0-py3-none-any.whl (26.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page