Created
June 1, 2013 17:20
-
-
Save anonymous/5691087 to your computer and use it in GitHub Desktop.
redditstatus.py
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
# 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