ttrss-python - A client library written in python

Development-related discussion, including bundled plugins
Vassius
Bear Rating Trainee
Bear Rating Trainee
Posts: 6
Joined: 01 Apr 2013, 16:53

ttrss-python - A client library written in python

Postby Vassius » 02 Apr 2013, 17:14


joseph-mx
Bear Rating Disaster
Bear Rating Disaster
Posts: 68
Joined: 19 Oct 2012, 05:19
Location: http://www.mxhub.com/reader/
Contact:

Re: ttrss-python - A client library written in python

Postby joseph-mx » 03 Apr 2013, 04:01

nice one, vassius!!
i am started to read more on python. seem to be getting popular soon. 8)

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: ttrss-python - A client library written in python

Postby fox » 03 Apr 2013, 08:40

Stickied.

Vassius
Bear Rating Trainee
Bear Rating Trainee
Posts: 6
Joined: 01 Apr 2013, 16:53

Re: ttrss-python - A client library written in python

Postby Vassius » 03 Apr 2013, 15:26


Firehand
Bear Rating Trainee
Bear Rating Trainee
Posts: 5
Joined: 21 Mar 2013, 11:52

Re: ttrss-python - A client library written in python

Postby Firehand » 03 Apr 2013, 17:30

I started a python version of the updater which parse all needed php files for variables (defines) and even evaluates expressions like VERSION . "Tiny Tiny RSS". Converted alot of PHP code (i am reading PHP code for 1st time). Everything worked fine until i realized that in some point i have to run all PHP plugins :D. So i hit the wall. I dont wanna write a new lexer and convert PHP code to python. Well, at least i understood how some of the tt-rss parts work and a little PHP :D

Vassius
Bear Rating Trainee
Bear Rating Trainee
Posts: 6
Joined: 01 Apr 2013, 16:53

Re: ttrss-python - A client library written in python

Postby Vassius » 05 Apr 2013, 10:06

The first versions used the cookie based authentication, which was removed in tt-rss 1.7.6. I just released ttrss-python 0.1.4 to PyPI to fix the broken authentication with newer server versions. It's of course backwards compatible with older tt-rss versions.

Vassius
Bear Rating Trainee
Bear Rating Trainee
Posts: 6
Joined: 01 Apr 2013, 16:53

Re: ttrss-python - A client library written in python

Postby Vassius » 10 Sep 2013, 00:03

After quite a long break from development, I have now released version 0.3 to PyPI. It now has basic support for labels.

ttrss-python is pretty much feature-complete by now, but I would love some feature requests, bug reports or other feedback.

Hope you enjoy this library!

Vassius
Bear Rating Trainee
Bear Rating Trainee
Posts: 6
Joined: 01 Apr 2013, 16:53

Re: ttrss-python - A client library written in python

Postby Vassius » 06 Oct 2013, 01:32

I have just released version 0.4 to PyPI.

Now with Python 3 support!

gonzaenz
Bear Rating Trainee
Bear Rating Trainee
Posts: 1
Joined: 29 Jul 2014, 19:50

Re: ttrss-python - A client library written in python

Postby gonzaenz » 29 Jul 2014, 20:04

hi,

i found some problems trying to connect into https.

>>> from ttrss.client import TTRClient
>>> tt = TTRClient("https://server.org/tt-rss","user", "pass")
>>> tt.login()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/gonzo/Documents/dev/rss_parse/lib/python2.7/site-packages/ttrss/client.py", line 50, in login
'password': self.password
File "/Users/gonzo/Documents/dev/rss_parse/lib/python2.7/site-packages/ttrss/client.py", line 75, in _get_json
r = self._session.post(self.url, data=json.dumps(data))
File "/Users/gonzo/Documents/dev/rss_parse/lib/python2.7/site-packages/requests/sessions.py", line 498, in post
return self.request('POST', url, data=data, **kwargs)
File "/Users/gonzo/Documents/dev/rss_parse/lib/python2.7/site-packages/requests/sessions.py", line 456, in request
resp = self.send(prep, **send_kwargs)
File "/Users/gonzo/Documents/dev/rss_parse/lib/python2.7/site-packages/requests/sessions.py", line 559, in send
r = adapter.send(request, **kwargs)
File "/Users/gonzo/Documents/dev/rss_parse/lib/python2.7/site-packages/requests/adapters.py", line 382, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:507: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

after some googling i find out that requests is validating SSL certificates. I'm using a self-signed certificate and some how requests is not using keychain(i'm using osx).

the workaround i found so far it is to disable the cerficate verification

>>> from ttrss.client import TTRClient
>>> tt = TTRClient("https://server.org/tt-rss","user", "pass")
>>> tt.__dict__['_session'].verify
True
>>> tt.__dict__['_session'].verify=False # don't verify certificates
>>> tt.__dict__['_session'].verify
False
>>> tt.login()
>>> a=tt.get_categories()
>>> pprint(a)
[<ttrss.client.Category object at 0x100f72dd0>,
<ttrss.client.Category object at 0x100f72f90>,
<ttrss.client.Category object at 0x100f72cd0>,
<ttrss.client.Category object at 0x100f72b90>,
<ttrss.client.Category object at 0x100f72f10>,
<ttrss.client.Category object at 0x100f727d0>,
<ttrss.client.Category object at 0x100f72750>,
<ttrss.client.Category object at 0x100f72fd0>,
<ttrss.client.Category object at 0x100f72f50>,
<ttrss.client.Category object at 0x100f72ed0>,
<ttrss.client.Category object at 0x100f78110>,
<ttrss.client.Category object at 0x100f78150>]

another option is to set enviroment variable REQUESTS_CA_BUNDLE pointing to certificate path. i have not tried it yet.

reference: http://docs.python-requests.org/en/late ... rification

hope it helps


Return to “Development”

Who is online

Users browsing this forum: No registered users and 4 guests