rienafairefr / pynYNAB

a python client for the new YNAB
MIT License
138 stars 12 forks source link

Jun 28 update breaks pynYNAB #44

Closed chbndrhnns closed 7 years ago

chbndrhnns commented 7 years ago

I have the following issues with pynYNAB:

The simple example from the README gives me:

Traceback (most recent call last): File "/Users/jo/dev/m2ynab/m2ynab/ynab.py", line 8, in <module> client = nYnabClient(nynabconnection=connection, budgetname='X') File "/Users/jo/.virtualenvs/m2ynab/lib/python2.7/site-packages/pynYNAB/Client.py", line 20, in __new__ return factory.create_client(passed) File "/Users/jo/.virtualenvs/m2ynab/lib/python2.7/site-packages/pynYNAB/ClientFactory.py", line 72, in create_client client_id = connection.user_id AttributeError: 'nYnabConnection' object has no attribute 'user_id'

After changing line 72 to client_id = connection.id, I get

pynYNAB.connection.NYnabConnectionError: Unknown API Error "invalid_session_token" was returned from the API when sending request ({'request_data': '{"user_id": "X", "changed_entities": {}, "device_knowledge_of_server": 0, "ending_device_knowledge": 0, "starting_device_knowledge": 0}', u'operation_name': 'syncCatalogData'})

rienafairefr commented 7 years ago

Which example are you following ? There might be a problem in the example. Live tests on CI are working (https://travis-ci.org/rienafairefr/pynYNAB/).

OK, can reproduce with the first example in /wiki/Examples-of-usage

Coming back with an updated wiki in a sec :-)

rienafairefr commented 7 years ago

OK it was just a missing init_session() , you create the connection, then init it to get the session token set up, then you can use it in a Client 👍

I've updated the wiki /wiki/Examples-of-usage