elupus / nibeuplink

Nibe Uplink asyncronous python interface
MIT License
23 stars 10 forks source link

Issue: AttributeError: 'list' object has no attribute 'split' #5

Open vaclaj opened 2 years ago

vaclaj commented 2 years ago

Hello, I'm very new here, trying to read values from my heatpump. I was able to install your modul to my RPI running python3. When I'm trying to run your script, following error will appear. Can you help me what can be wrong:

pi@raspberrypi:~ $ python3 .local/bin/nibeuplink --client_id xxxxxxx --client_secret yyyyyyyy --redirect_uri https://www.marshflattsfarm.org.uk/nibeuplink/oauth2callback/index.php --verbose 2022-01-16 19:29:59,648 - asyncio - DEBUG - Using selector: EpollSelector Traceback (most recent call last): File ".local/bin/nibeuplink", line 10, in sys.exit(main()) File "/home/pi/.local/lib/python3.7/site-packages/nibeuplink/main.py", line 186, in main loop.run_until_complete(run()) File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete return future.result() File "/home/pi/.local/lib/python3.7/site-packages/nibeuplink/main.py", line 84, in run scope=scope, File "/home/pi/.local/lib/python3.7/site-packages/nibeuplink/session.py", line 63, in init if set(scope).issubset(set(access_data["scope"].split(" "))): AttributeError: 'list' object has no attribute 'split'

elupus commented 2 years ago

Strange. Looks like the scope field in the access data file that got generated is a list instead of string.

vaclaj commented 2 years ago

Is there any kind of output which I can provide for troubleshooting? I've noticed also an other issue during json token creation: python3 .local/bin/nibeuplink --client_id XXXXX --client_secret YYYYYYY --redirect_uri https://www.marshflattsfarm.org.uk/nibeuplink/oauth2callback/index.php https://api.nibeuplink.com/oauth/authorize?response_type=code&client_id=XXXXXXXXXXXXXXXX&redirect_uri=https%3A%2F%2Fwww.marshflattsfarm.org.uk%2Fnibeuplink%2Foauth2callback%2Findex.php&scope=READSYSTEM&state=AAAAAAAAAAAAAAAAAAAA Enter full redirect url: BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB Traceback (most recent call last): File ".local/bin/nibeuplink", line 10, in sys.exit(main()) File "/home/pi/.local/lib/python3.7/site-packages/nibeuplink/main.py", line 186, in main loop.run_until_complete(run()) File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete return future.result() File "/home/pi/.local/lib/python3.7/site-packages/nibeuplink/main.py", line 91, in run await session.get_access_token(session.get_code_from_url(result)) File "/home/pi/.local/lib/python3.7/site-packages/nibeuplink/session.py", line 172, in get_code_from_url return query["code"][0] KeyError: 'code' (sensitive info replaced) This was fixed by usage of json token generated in other tool.

elupus commented 2 years ago

Well. You are not doing as instructed. Enter the whole url you were redirected to, no the extracted code.