User Tools

Site Tools


# LeedUnread

## Overview

It's a small Python3 script that retrieve the total of unread RSS feed from your Leed RSS Reader. The plugin LeedApi needs to be installed for this script to work

You need to provide:

* The URL fo your server * Your username, in plain text * The salted password that's stored in the `users` table

  • It seems to be the only way to use the API… Not really easy though >_<

## Code
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python modules
import requests			# API Calls
import json			# Parse API data
_ServURL = 'http://YOUR_SERVER/plugins/api/'
_Login = 'YOUR_LOGIN'
def APICall(cmd):
	sess = requests.Session()
	url = _ServURL + 'login.php?login='+_Login+'&password='+_Pwd
	payload = { }
	headers = {'content-type': 'application/x-www-form-urlencoded'}
	r = sess.get(url, data=json.dumps(payload), headers=headers, auth=requests.auth.HTTPDigestAuth(_Login, _Pwd))
	url = _ServURL + 'json.php?option='+cmd
	payload = { }
	headers = {'content-type': 'application/x-www-form-urlencoded'}
	r =, data=json.dumps(payload), headers=headers)
	rj = json.loads(r.text)
	return rj
# Pretty dump of a JSON object
def jDump(obj):
Nb = 0;
rj = APICall('getFolders&unreadOnly')
if 'folders' in rj:
	folders = rj['folders']
	for folder in folders:
		if 'flux' in folder:
			#if 'titre' in folder:
			#	print(folder['titre'])
			for flux in folder['flux']:
				flux = folder['flux'][flux]
				if 'nbNoRead' in flux:
					#if 'name' in flux:
					Nb = Nb + int(flux['nbNoRead']);
/home/share/www/ · Last modified: 2023/11/24 21:55 by