Skip to content

Instantly share code, notes, and snippets.

@eritbh
Last active October 9, 2017 04:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eritbh/0d28cad736771a6c8a7bd86eeb4bfd0a to your computer and use it in GitHub Desktop.
Save eritbh/0d28cad736771a6c8a7bd86eeb4bfd0a to your computer and use it in GitHub Desktop.
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