Skip to content

Instantly share code, notes, and snippets.

Created June 1, 2013 17:20
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 anonymous/5691087 to your computer and use it in GitHub Desktop.
Save anonymous/5691087 to your computer and use it in GitHub Desktop.
redditstatus.py
# coding=UTF-8
import praw
import requests
username = 'undergroundmonorail'
password = [REDACTED]
try:
r = praw.Reddit('Status Checker v0.1 by /u/undergroundmonorail')
r.login(username, password)
me = r.get_redditor(username)
ms = 0
for m in r.get_unread():
ms += 1
out = "{} messages | {} · {}".format(ms, me.link_karma, me.comment_karma)
with open('current', 'w') as file:
file.write(out.replace("1 messages", "1 message"))
except requests.ConnectionError:
with open('current' 'w') as file:
file.write("reddit is down")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment