Skip to content

Instantly share code, notes, and snippets.

/redditstatus.py.py
Created Jun 1, 2013

Embed
What would you like to do?
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
You can’t perform that action at this time.