Quantcast
Channel: zeldor.biz
Viewing all articles
Browse latest Browse all 10

Tiny Tiny RSS reading stats

$
0
0

I wrote since 2013 a lot [1][2] about self hosted Tiny Tiny RSS Feed reader and this one is still alive and rung pretty smoothly :)

A couple weeks ago a wrote the following dirty-python-script to read out over the Tiny Tiny RSS API the amount of unread feeds for better reading control. The output of it is running into telegraf which sends the data to an influxdb which can be pretty visualised by grafana.

If you run Tiny Tiny RSS, probably this can be useful for you ;)

import requests
import json
import sys

url = 'https://ttrss.example/api/'
session_payload = {"op":"login","user":"YOURUSER","password":"YOURPASSWORD"}

try:
    r = requests.post(url, data=json.dumps(session_payload))
except:
    print('Could not connect to: ', url)
    sys.exit(0)

if r.status_code == 200:
    session_id = r.json()['content']['session_id']
    if session_id:
        login_payload = {"sid":session_id,"op":"getUnread"}
        r = requests.post(url, data=json.dumps(login_payload))

        if r.status_code == 200:
            unread = r.json()['content']['unread']
            print("ttrss,datacenter=uk-east01,host=system.example.com unread_articles=%s" % unread)

Official documentation provides also a pretty Tiny Tiny RSS API deep description.


Viewing all articles
Browse latest Browse all 10

Trending Articles