hzulla / tolino-python

Access to tolino cloud with Python 3
GNU Lesser General Public License v2.1
78 stars 35 forks source link

after updating the system i get ... #16

Closed Barnestos closed 8 years ago

Barnestos commented 8 years ago

Hello, First, i want to say that your program is the perfect completion to the tolino. But, since today get the following messages:

Traceback (most recent call last): File "/home/bernhard/tolino/tolinocloud.py", line 251, in login self.access_token = base64.b64decode(b64).decode('utf-8') File "/usr/lib/python3.5/base64.py", line 88, in b64decode return binascii.a2b_base64(s) binascii.Error: Incorrect padding

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/bernhard/tolino/tolinoclient.py", line 161, in args.func(args) File "/home/bernhard/tolino/tolinoclient.py", line 47, in devices c.login(args.user, args.password) File "/home/bernhard/tolino/tolinocloud.py", line 253, in login raise TolinoException('oauth access token request failed.') tolinocloud.TolinoException: oauth access token request failed.

thank you, Bernhard

Barnestos commented 8 years ago

there was a '%3D%3D' at the end of the token. (thalia.de) I replaced it with '=':

tolinocloud.py ... b64 = re.search(r'\?tat=(.*?)\"', r.text).group(1) b64 = b64.replace('%3D', '=') <<<<<<<<<<<<< that will do the trick... self.access_token = base64.b64decode(b64).decode('utf-8') ...

now it's working normal.

mfg, Bernhard

theopenbit commented 8 years ago

this fix is working for me too! Are you able to make a merge request for it?

Barnestos commented 8 years ago

I'm a newbie on github...

theopenbit commented 8 years ago

Hi Barnestos, I've integrated your fix in my fork and made a merge request for it. Thank you for bugfixing!