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

my own code giving "Failed to authorize client skoda" #50

Closed
flopp999 opened this issue Nov 18, 2021 · 4 comments
Closed

my own code giving "Failed to authorize client skoda" #50

flopp999 opened this issue Nov 18, 2021 · 4 comments

Comments

@flopp999
Copy link
Contributor

I am using your code inside my own code for Domoticz.

When I start Domoticz I get this error, if I restart my code it start to work. So my code is working and I am trying to find a way to solve the error.

Do you know a command that I can use with your code to restart the get_vehicles?

Thanks

Traceback (most recent call last):
File "/home/debian/domoticz/plugins/Skoda/plugin.py", line 70, in main
await connection.get_vehicles()
File "/usr/local/lib/python3.9/dist-packages/skodaconnect/connection.py", line 670, in get_vehicles
await self.set_token('skoda')
File "/usr/local/lib/python3.9/dist-packages/skodaconnect/connection.py", line 1666, in set_token
raise SkodaAuthenticationException(f'Failed to authorize client {client}')
skodaconnect.exceptions.SkodaAuthenticationException: Failed to authorize client skoda
<class 'skodaconnect.exceptions.SkodaAuthenticationException'>
@Farfar
Copy link
Collaborator

Farfar commented Nov 18, 2021

I am using your code inside my own code for Domoticz.

When I start Domoticz I get this error, if I restart my code it start to work. So my code is working and I am trying to find a way to solve the error.

Do you know a command that I can use with your code to restart the get_vehicles?

Thanks

Traceback (most recent call last):
File "/home/debian/domoticz/plugins/Skoda/plugin.py", line 70, in main
await connection.get_vehicles()
File "/usr/local/lib/python3.9/dist-packages/skodaconnect/connection.py", line 670, in get_vehicles
await self.set_token('skoda')
File "/usr/local/lib/python3.9/dist-packages/skodaconnect/connection.py", line 1666, in set_token
raise SkodaAuthenticationException(f'Failed to authorize client {client}')
skodaconnect.exceptions.SkodaAuthenticationException: Failed to authorize client skoda
<class 'skodaconnect.exceptions.SkodaAuthenticationException'>

You can call the method connection.get_vehicles() directly. Or have I misunderstood you?
It might help if you paste relevant code snippet from your code.

@flopp999
Copy link
Contributor Author

@Farfar
Copy link
Collaborator

Farfar commented Nov 18, 2021

Thanks for quick reply. Please see link below https://github.com/flopp999/SkodaConnect-Domoticz/blob/36c5aa4aa0c241e65a5b7d3cd86f059fd70be6f4/plugin.py#L70

I would, on line 70, add some error handling. The get_vehicles method should return a dict with the vehicle information. If something goes wrong it will error out. So a "simple" try: except: clause would solve it. Perhaps add a loop or something to loop with a set delay until it succeeds.

@Farfar Farfar closed this as completed Jan 12, 2022
@Farfar
Copy link
Collaborator

Farfar commented Jan 12, 2022

Closed this issue since it isn't related to the library.

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