philippelt / netatmo-api-python

Netatmo connect API python client (for Netatmo information, see https://dev.netatmo.com)
GNU General Public License v3.0
191 stars 120 forks source link

printThermostat: Authentication request rejected #33

Closed DLAcoding closed 5 years ago

DLAcoding commented 5 years ago

Hi,

I am trying to use your API to retrieve info from my thermostat.

I downloaded your code from github, hardcode my credentials in the file ".netatmo.credentials", copy the printThermostat.py in the same folder than lnetatmo.py and run in Python 3.7 in Windows 10.

I got an error when calling:

authorization = lnetatmo.ClientAuth()

This is the output of the error:

File "E:\Python\netatmo-api-python\lnetatmo.py", line 187, in __init__ if not resp: raise AuthFailure("Authentication request rejected") lnetatmo.AuthFailure: Authentication request rejected

Am I doing something wrong?

Thanks in advance and thanks for your work!

philippelt commented 5 years ago

Hello,

from your filename syntax, I assume you are running on Windows machine.

Did you noticed the issue with the USERNAME env variable automatically set by Windows on login username that conflicts with the same env variable use by the library that override other settings (including credential file). for lnetatmo, USERNAME env variable if it exists should contain your netatmo account login id.

I like to use env variable because it is the easiest way to configure containers at run time.

The simplest solution is to "unset" the env variable before running your code.

And be sure to use the last version of the library available, it will provides some more information in case of auth failure...

Sincerely Philippe

DLAcoding commented 5 years ago

Hi Philippe,

I think I understand what you mean. I tested it now in a raspberry and I was able to make it work.

Thanks for your work and your attention!