Last active
December 17, 2015 12:19
-
-
Save thesnapdragon/5609296 to your computer and use it in GitHub Desktop.
little Python script to get count of unread RSS feeds from The Old Reader
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# Milán Unicsovics, u.milan at gmail dot com | |
# usage: ./rssToConky.py | |
# writes out the count of unread RSS feeds from The Old Reader (http://theoldreader.com/) | |
import requests | |
import json | |
def main(): | |
try: | |
user = 'EMAILADDRESS' | |
password = 'PASSWORD' | |
session = requests.Session() | |
# login | |
data = {'user[email]': user, 'user[password]': password} | |
session.post('http://theoldreader.com/users/sign_in', data = data, timeout = 5) | |
# get feeds | |
response = session.get('http://theoldreader.com/feeds/counts.json', timeout = 5) | |
feeds = json.loads(response.text)['feeds'][0]['feeds'] | |
unread = 0 | |
for feed in feeds: | |
unread += int(feed['unread_count']) | |
print(unread) | |
except requests.exceptions.Timeout: | |
print(0) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment