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

Server sporadically complains about incorrect bearer token #36

Open
eras opened this issue Dec 1, 2023 · 0 comments
Open

Server sporadically complains about incorrect bearer token #36

eras opened this issue Dec 1, 2023 · 0 comments

Comments

@eras
Copy link
Owner

eras commented Dec 1, 2023

Maybe do one retry in this case, because next request seems to work?

Backtrace:

2023-12-01 13:46:02,041 ERROR    teslabot.tesla txn ba7173b9-c18c-4d3e-9e84-f984396c34a9 401 Client Error: invalid bearer token for url: https://owner-api.teslamotors.com/api/1/vehicles Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/teslabot/tesla.py", line 765, in _command_on_vehicle
    vehicle = await self._get_vehicle(vehicle_name)
  File "/usr/local/lib/python3.9/dist-packages/teslabot/tesla.py", line 486, in _get_vehicle
    vehicles = await self._get_vehicle_list()
  File "/usr/local/lib/python3.9/dist-packages/teslabot/tesla.py", line 475, in _get_vehicle_list
    result_or_error = await self._retry_to_async(call)
  File "/usr/local/lib/python3.9/dist-packages/teslabot/tesla.py", line 756, in _retry_to_async
    return await self._retry(call)
  File "/usr/local/lib/python3.9/dist-packages/teslabot/tesla.py", line 722, in _retry
    result = await fn()
  File "/usr/local/lib/python3.9/dist-packages/teslabot/tesla.py", line 755, in call
    return await to_async(call2)
  File "/usr/local/lib/python3.9/dist-packages/teslabot/asyncthread.py", line 26, in to_async
    raise value_or_exn
  File "/usr/local/lib/python3.9/dist-packages/teslabot/asyncthread.py", line 16, in call_it
    return Value(fn())
  File "/usr/local/lib/python3.9/dist-packages/teslabot/tesla.py", line 754, in call2
    return fn()
  File "/usr/local/lib/python3.9/dist-packages/teslabot/tesla.py", line 473, in call
    self.cached_vehicle_list = self.tesla.vehicle_list()
  File "/usr/local/lib/python3.9/dist-packages/teslapy/__init__.py", line 369, in vehicle_list
    return [Vehicle(v, self) for v in self.api('VEHICLE_LIST')['response']]
  File "/usr/local/lib/python3.9/dist-packages/teslapy/__init__.py", line 363, in api
    return self.request(endpoint['TYPE'], uri, serialize,
  File "/usr/local/lib/python3.9/dist-packages/teslapy/__init__.py", line 155, in request
    response.raise_for_status()  # Raise HTTPError, if one occurred
  File "/usr/local/lib/python3.9/dist-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: invalid bearer token for url: https://owner-api.teslamotors.com/api/1/vehicles
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

1 participant