Last active
October 9, 2017 04:35
-
-
Save eritbh/0d28cad736771a6c8a7bd86eeb4bfd0a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import praw, time, requests, json | |
r = praw.Reddit( | |
client_id="", | |
client_secret="", | |
username="", | |
password="", | |
user_agent="script:some_random_identifier:v1.0 (by /u/you)") | |
sub = r.subreddit("your_sub") # no /r/ here | |
while True: | |
with open('path/to/data.json') as data_file: | |
data = json.load(data_file) | |
sidebar_template = sub.wiki["sidebar_template"].content_md | |
sidebar = sidebar_template.replace("{NUM}", data["USERS_ONLINE"]) | |
edit_msg = "https://github.com/{}/compare/{}" | |
sub.wiki["config/sidebar"].edit(sidebar, edit_msg) | |
time.sleep(60 * 5) # in seconds, this sets it to 5 minutes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment