Skip to main content

RedditReport

Python package created for trendsreport.app

This package relies on praw library to communicate with Reddit API. To install it:

pip install praw==7.1.4
pip install redditreport

Classes

RedditUser

It represents a Reddit account to interact with the Reddit API. Its only method get_reddit_instance returns a praw Reddit instance.

RedditPost

It represents the Reddit post. It contains a praw submission object and some post data:

  • sub_name
  • title
  • url
  • score
  • num_comments

Its only method as_dict returns a Python dict object with the data stored in it.

You don't need to use this class unless you want to modify what the report contains.

RedditReport

It represents the actual Reddit report. In order to work, it needs to be passed in some initial attributes:

  • reddit -> a praw Reddit instance. You can get it usig RedditUser's get_reddit_instance method.
  • subs_list -> a Python list object with the names (as strings) of the subreddits you do want to include in the report.
  • lines_per_sub -> a maximum post limit per sub in the report.

The report data is stored in its report_data attribute as a Python dict.

It has two methods:

  • generate_data which populates report_data dict with RedditPost's objects.
  • serialize which transform every object inside report_data into a dict of strings.

Example

from redditreport.core import RedditUser as ru
from redditreport.core import RedditReport as rr

# Your Reddit API credentials.
# More info: https://www.geeksforgeeks.org/python-praw-python-reddit-api-wrapper/
client_id = 'your-client-id'
client_secret = 'your-client-secret'
user_agent = 'your-user-agent'
reddit_user = ru.RedditUser(client_id, client_secret, user_agent)

# Reddit object instance from praw library
reddit_instance = reddit_user.get_reddit_instance()

# RedditReport instance
subs_list = ['pics', 'askreddit']   # must be a list
lines_per_sub = 3   # must be an integer
reddit_report = rr.RedditReport(reddit_instance, subs_list, lines_per_sub)

# Pulls data from Reddit
report_data = reddit_report.generate_data()

# Serializes it
serialized_report_data = reddit_report.serialize()

Metadata

Release files for redditreport 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redditreport 0.4.0
File Size Uploaded
redditreport-0.4.0.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for redditreport 0.4.0
File Interpreter ABI Platform
redditreport-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.7 kB

Release files / redditreport-0.4.0.tar.gz

Download URL redditreport-0.4.0.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
49162b4335b13f4d4979a443c89f44ffc998c07181d73a4598622176866cfe6e
BLAKE2b-256 checksum
How to use checksums
0a49147b1dab3c6a6147bfc162ea5802229cfd75f0cec1bff7363c5d82994716
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release files / redditreport-0.4.0-py3-none-any.whl

Download URL redditreport-0.4.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
065d5729d5c742490ffcf7bda9440835950a596d5ced484137237744cd75f1af
BLAKE2b-256 checksum
How to use checksums
2da64fd6d9cc5e0684c4c9659d822b62766d259173646589bd3c3b4f4a59050d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page