Skip to main content

Reddit Gateway API Library

Project description

GateRed

A library to fetch Reddit data using Reddit WebAPI (gateway), w/ pushshift historical submissions support.

Latest Version Supported Python Versions CI Code style: black GitHub license

Documentation · Replit Playground

Why this library?

Although Reddit has developer APIs and there are existing libraries (e.g. praw) to interact with reddit, there are still several drawbacks in terms of collecting data:

  • An API key is needed to collect data.
  • Rate limit is based on API keys.
  • Some fields are missing using developer APIs.

Therefore, gatered exists just to counter this problem. It directly access Reddit's web API to get the whole information. No authentication is needed, and it supports proxy provided by httpx.

Install

You can install this library easily from pypi:

# with pip
pip install gatered

# with poetry
poetry add gatered

Using

The library provides easy functions to get start fast:

  • gatered.func.get_post_comments
  • gatered.func.get_posts_with_subreddit_info
  • gatered.func.get_posts
  • gatered.func.get_comments
  • gatered.func.get_pushshift_posts

Alternatively you can directly use gatered.client.Client and gatered.pushshift.PushShiftAPI classes as your base to implement your own logics.

Errors can be handled by importing either gatered.RequestError or gatered.HTTPStatusError, see httpx exceptions to learn more.

See examples/ for more examples. Alternately, you can fork the example repo on Replit and play around online.

License

Copyright 2022 CounterTek

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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

gatered-1.2.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

gatered-1.2.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file gatered-1.2.0.tar.gz.

File metadata

  • Download URL: gatered-1.2.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.2 Linux/5.11.0-1028-azure

File hashes

Hashes for gatered-1.2.0.tar.gz
Algorithm Hash digest
SHA256 7458f8ed47a1df8995579f11af0429a1f26713385eafa8060d65d42943917b77
MD5 7183c42c208399c61b40de88c0fc6b29
BLAKE2b-256 5f52b9c93b0f47febebac28a370f522962d5e86558e49911872ee0598daa6ca0

See more details on using hashes here.

File details

Details for the file gatered-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: gatered-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.8.2 Linux/5.11.0-1028-azure

File hashes

Hashes for gatered-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fcc2c35cebb0f68d97377bfee7a51bf99885f7e13eb02da1de23c83e5d0765f6
MD5 b7e50f255361495f8cee5b364f46ab75
BLAKE2b-256 39ca212676aa5967819ba3a3abef7b75dd673a080732c0a0cae13fc14d1ddc3e

See more details on using hashes here.

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