Skip to content

Instantly share code, notes, and snippets.

@thesnapdragon
Last active December 17, 2015 12:19
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 thesnapdragon/5609296 to your computer and use it in GitHub Desktop.
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
#!/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