TT-RSS notification of unread articles

I use Tiny Tiny RSS as an alternative to Google Reader. It is an open source web based RSS feed reader.

I created a little Python script that shows a notification on the Mac OS X desktop in case I have unread articles. It is called from crontab. Every ten minutes, the script checks for unread messages and shows a message via Growl:


  • Python, which is probably already installed on most Linuxes and Mac OS X. It uses the json, urllib2 and os modules
  • Growl, install also growlnotify from the Extras
  • And Tiny Tiny RSS, tested with version 1.5.5

For Linux, libnotify provides the a command line interface for displaying notifications: notify-send. You can use that instead of growlnotify for showing the number of unread articles. In Ubuntu, notify-send is found in package libnotify-bin.


import json
import urllib2
import os
class request:
class ttrss:
	session_id = ''
	def __init__(self, url):
		self.baseurl = url
	def getResponse(self, call):
		call['sid'] = self.session_id
		httpres = urllib2.urlopen(self.baseurl, json.dumps(call))
		ttrssresponse = json.load(httpres)
		return ttrssresponse
	def login(self, username, password):
		req = { 'op': 'login', 'user': username, 'password':password }
		res = self.getResponse(req)
		self.session_id = res['content']['session_id']
	def getUnreadCount(self):
		req = { 'op': 'getUnread'}
		res = self.getResponse(req)
		return int( res['content']['unread'] )
t = ttrss('')
# Username, password
unread = t.getUnreadCount()
if (unread > 0):
	cmd = "/usr/local/bin/growlnotify -a Mail -m '" + str( unread ) + " unread article(s)' --url Tiny Tiny RSS"
	os.system( cmd )

4 Responses to “TT-RSS notification of unread articles”

  1. […] Get TTRSS Notifications in Growl (OS X) or libnotify (Linux) […]

  2. Tim Kramer says:

    Works nicely with notify-send on Ubuntu 12.10. The one issue that I encountered was of my own doing (not using the standard URL). Once I’d noticed that, it worked without any additional modification. Thanks!

  3. Martin says:


    thank you for your Script – i changed it to work with terminal-notifier:

    cmd = “/usr/local/bin/ -title ‘Tiny Tiny RSS’ -message ‘” + str( unread ) + ” unread article(s) Tiny Tiny RSS’ -open

    Great Work!