codesnip:unread_leed
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| codesnip:unread_leed [2014/02/02 11:35] – [Code] redox | codesnip:unread_leed [Unknown date] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | # 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 | ||
| - | <code python> | ||
| - | # | ||
| - | # -*- coding: utf-8 -*- | ||
| - | |||
| - | # Python modules | ||
| - | import requests # | ||
| - | import json # Parse API data | ||
| - | import hashlib # MD5 | ||
| - | |||
| - | _ServURL = ' | ||
| - | _Login = ' | ||
| - | _Pwd = ' | ||
| - | |||
| - | def APICall(cmd): | ||
| - | sess = requests.Session() | ||
| - | url = _ServURL + ' | ||
| - | payload = { } | ||
| - | headers = {' | ||
| - | r = sess.get(url, | ||
| - | |||
| - | url = _ServURL + ' | ||
| - | payload = { } | ||
| - | headers = {' | ||
| - | r = sess.post(url, | ||
| - | rj = json.loads(r.text) | ||
| - | return rj | ||
| - | |||
| - | # Pretty dump of a JSON object | ||
| - | def jDump(obj): | ||
| - | print(json.dumps(obj, | ||
| - | |||
| - | Nb = 0; | ||
| - | rj = APICall(' | ||
| - | #jDump(rj) | ||
| - | if ' | ||
| - | folders = rj[' | ||
| - | for folder in folders: | ||
| - | if ' | ||
| - | #if ' | ||
| - | # | ||
| - | for flux in folder[' | ||
| - | flux = folder[' | ||
| - | if ' | ||
| - | #if ' | ||
| - | # | ||
| - | Nb = Nb + int(flux[' | ||
| - | print(Nb) | ||
| - | </ | ||
/home/share/www/redox.ws/wiki/data/attic/codesnip/unread_leed.1391340931.txt.gz · Last modified: 2023/11/24 21:55 (external edit)