A simple python script that uses PRAW to track Reddit karma. The script logs an account's total karma and dynamically generates a chart with the data it's collected. Below is an example using data collected from /u/GallowBoob – a Redditor who's infamous for his high karma count. The chart is showing data that was collected every minute for over 3 months.
git clone https://github.com/paramt/trackarma.git
pip install praw
pip install matplotlib
- Create a new app on Reddit
- Follow this link
- Click
create new app
- Choose
personal use script
- Add a name and description
- Click
create app
and copy the ID and secret
- Create a file named
praw.ini
inside the repo - Make a new configuration that looks like this
[Bot]
client_id=[YOUR APP ID]
client_secret=[YOUR APP SECRET]
user_agent=Karma Tracker Bot 1.0
- Open
constants.py
- Change the value of
reddit_name
to the username you're tracking - Optionally, you can change other constants there (like the chart's title)
Run sudo python -m src.collect_data
at a constant interval using Crontab on Linux or Task Scheduler on Windows.
To generate the chart, run sudo python -m src.generate_chart
. The live example is running both commands every minute, but you may choose to run them at any interval
The script will output everything in data/
chart.png
– a line graph displaying the Redditor's karma over timedates.txt
– the datetime entries of each timecollect_data.py
rankarma-total.txt
– a record of the Redditor's karma over timekarma-delta.txt
– a record of the Redditor's karma gain over time
This project is licensed under the MIT license. You are free to use, modify, and distribute the source code as long as you include the original license file.