Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while getting data (line 770 - 771) #3

Open
mschlenstedt opened this issue Oct 25, 2020 · 3 comments
Open

Error while getting data (line 770 - 771) #3

mschlenstedt opened this issue Oct 25, 2020 · 3 comments

Comments

@mschlenstedt
Copy link

I got this error:

[INFO    ]-2020-10-25 09:40:38 Getting openid config...
[INFO    ]-2020-10-25 09:40:39 Done!
[INFO    ]-2020-10-25 09:40:39 Getting authorization...
[INFO    ]-2020-10-25 09:40:39 Done!
[INFO    ]-2020-10-25 09:40:39 Parsing authorization...
[INFO    ]-2020-10-25 09:40:39 Done!
[INFO    ]-2020-10-25 09:40:39 Sending email form...
[INFO    ]-2020-10-25 09:40:39 Done!
[INFO    ]-2020-10-25 09:40:39 Parsing email form response...
[INFO    ]-2020-10-25 09:40:39 Done!
[INFO    ]-2020-10-25 09:40:39 Sending password form...
[INFO    ]-2020-10-25 09:40:40 Done!
[INFO    ]-2020-10-25 09:40:40 Done!
[INFO    ]-2020-10-25 09:40:40 Retrieving tokens...
[INFO    ]-2020-10-25 09:40:40 Done!
[INFO    ]-2020-10-25 09:40:40 Retrieving VW tokens...
[INFO    ]-2020-10-25 09:40:41 Done!
[INFO    ]-2020-10-25 09:40:41 Tokens OK
Traceback (most recent call last):
  File "./sc2mqtt.py", line 929, in <module>
    asyncio.run(main())
  File "/usr/local/lib/python3.7/dist-packages/nest_asyncio.py", line 31, in run
    return loop.run_until_complete(future)
  File "/usr/local/lib/python3.7/dist-packages/nest_asyncio.py", line 95, in run_until_complete
    return f.result()
  File "/usr/lib/python3.7/asyncio/futures.py", line 178, in result
    raise self._exception
  File "/usr/lib/python3.7/asyncio/tasks.py", line 223, in __step
    result = coro.send(None)
  File "./sc2mqtt.py", line 69, in main
    await ad.init()
  File "./sc2mqtt.py", line 920, in init
    t = await self.getVehicleRights(car)
  File "./sc2mqtt.py", line 519, in getVehicleRights
    "followAllRedirects": True
  File "./sc2mqtt.py", line 771, in execRequest
    raise HTTPCodeException("Got HTTP%d; %s"%(r.status_code, r.text), r.status_code)
__main__.HTTPCodeException: ('Got HTTP401; {"error":{"errorCode":"gw.error.authentication","description":"Unauthorized"}}', 401)

If I comment out line 770 and 771, everything works fine and I receive correct data from the server.

@DBa2016
Copy link
Owner

DBa2016 commented Nov 25, 2020

The 401 return code means "unauthorized", so something went sideways during authentication. Lines 770 and 771 handle return codes over 400 (authorization issues):

         if r.status_code >= 400: # ignore successful and redirected codes
            raise HTTPCodeException("Got HTTP%d; %s"%(r.status_code, r.text), r.status_code)

Ignoring a 401 code can raise a red flag on your account, I wouldn't do it easily.

@mschlenstedt
Copy link
Author

Account data is correct and everything is fine when I comment out the lines. I receive correct data from my cars.

@mschlenstedt
Copy link
Author

mschlenstedt commented Dec 31, 2020

I investigated this a little bit more. Soulution is NOT to comment out line 770-771 - you are absolutely right.

Problem with my account is, that getVehicleRights(car) seems to fail with 401. Don't know why. I haven't confirmed my account by a Skoda service partner (so I am not able to open/close the vehicle via app). Maybe this is the reason?

If I comment out grabbing the VehicleRights, everything works fine.

t = await self.getVehicleRights(car)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants