skodaconnect / myskoda

Python library for interacting with MySkoda APIs.
MIT License
9 stars 20 forks source link

Error generating fixtures Enyaq 80 #114

Open sonar98 opened 4 weeks ago

sonar98 commented 4 weeks ago

when generating all fixtures using the myskoda client I get an error at the trip-statistics endpoint


  error: "Traceback (most recent call last):\n  File \"/usr/local/lib/python3.13/site-packages/myskoda/myskoda.py\",
    line 284, in generate_fixture_report\n    result = await self.get_endpoint(vin,
    endpoint, anonymize=True)\n             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
    \ File \"/usr/local/lib/python3.13/site-packages/myskoda/myskoda.py\", line 327,
    in get_endpoint\n    result = await self.rest_api.get_trip_statistics(vin, anonymize=anonymize)\n
    \            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
    \ File \"/usr/local/lib/python3.13/site-packages/myskoda/rest_api.py\", line 187,
    in get_trip_statistics\n    data=await self._make_get_request(url),\n         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
    \ File \"/usr/local/lib/python3.13/site-packages/myskoda/rest_api.py\", line 95,
    in _make_get_request\n    return await self._make_request(url=url, method=\"GET\")\n
    \          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/local/lib/python3.13/site-packages/myskoda/rest_api.py\",
    line 85, in _make_request\n    response.raise_for_status()\n    ~~~~~~~~~~~~~~~~~~~~~~~~~^^\n
    \ File \"/usr/local/lib/python3.13/site-packages/aiohttp/client_reqrep.py\", line
    1157, in raise_for_status\n    raise ClientResponseError(\n    ...<5 lines>...\n
    \   )\naiohttp.client_exceptions.ClientResponseError: 404, message='Not Found',
    url='https://mysmob.api.connect.skoda-auto.cz/api/v1/trip-statistics/TXXXXXXXXXXXXX?offsetType=week&offset=0&timezone=Europe/Berlin'\n"
WebSpider commented 4 weeks ago

yeah, i also just encountered it, you beat me to reporting it :) Workaround on Linux is a small loop:

for i in info status air_conditioning positions health charging maintenance driving_range; 
do poetry run myskoda --user USERNAME --password PASSWORD gen-fixtures --vehicle VIN --name i_want_weekend_$i --description "Is it weekend yet?" --file filename_here_$i get $i; 
done
dvx76 commented 3 weeks ago

I think this works as designed. An error is logged for any endpoint which returns an error but the command continues and completes and the fixture file is generated (including the expected error for the given endpoint).

The VIN being leaked into the fixture in case of an error is covered in #100

WebSpider commented 3 weeks ago

The problem here is that when using the all option, the trip-statistics causes an exception.

Silently passing on, or reporting in a fixture that this isnt supported would be even neater

dvx76 commented 2 weeks ago

Yeah the error being logged is confusing but the end result is a usable fixture. Since it's just a helper tool to generate fixtures I'm not too concerned about it being super polished. But a PR is always an option 😄