calmjm / tojota

Functions for interacting with Toyota MyT API
Apache License 2.0
73 stars 15 forks source link

Error in Get parking info... #16

Closed moseisleydk closed 3 years ago

moseisleydk commented 3 years ago

╰─# python tojota.py 1 ↵ 2020-11-19 19:33:02,852:main:INFO: Fetching trips... 2020-11-19 19:33:03,375:main:INFO: Get parking info... Traceback (most recent call last): File "tojota.py", line 454, in sys.exit(main()) File "tojota.py", line 384, in main parking, fresh = myt.get_parking() File "tojota.py", line 209, in get_parking raise ValueError('Failed to get data {} {} {}'.format(r.text, r.status_code, r.headers)) ValueError: Failed to get data 204 {'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'Pragma': 'no-cache', 'Expires': '0', 'Server': 'Jetty(9.3.25.v20180904)', 'Request-Context': 'appId=cid

..... ..... HtL; path=/; Max-Age=900', 'Date': 'Thu, 19 Nov 2020 18:34:13 GMT', 'X-CDN': 'Incapsula', 'X-Iinfo': '12-866863-866865 NNNY CT(0 0 0) RT(1605810852783 52) q(0 0 0 -1) r(2 2) U11'}

calmjm commented 3 years ago

Seems that if there is no parking info it returns HTTP 204 with no content. Code is not expecting that to happen (yet).

moseisleydk commented 3 years ago

ok :-) Hoping for a fix, so my RAV4 data can be added to my splunk and home-assistant.

moseisleydk commented 3 years ago

In from Denmark - and Trips seems empty (I guess there should be data)?

(tojota) ╭─root@sparrow ~/tojota/cache ‹master› ╰─# ls -l trips total 20 -rw-rw-r-- 1 bnp bnp 69 Nov 8 18:31 trips-2020-11-08T18:31:33.496236+01:00 -rw-rw-r-- 1 bnp bnp 69 Nov 9 13:34 trips-2020-11-09T13:34:03.579700+01:00 -rw-r--r-- 1 root root 69 Nov 19 19:32 trips-2020-11-19T19:32:26.729906+01:00 -rw-rw-r-- 1 bnp bnp 69 Dec 16 09:06 trips-2020-12-16T09:06:20.975062+01:00 -rw-r--r-- 1 root root 69 Dec 30 18:04 trips-2020-12-30T18:04:42.714711+01:00 (tojota) ╭─root@sparrow ~/tojota/cache ‹master› ╰─# cat trips/ {"recentTrips":[],"metadata":{"from":"2020-11-02","to":"2020-11-08"}}{"recentTrips":[],"metadata":{"from":"2020-11-03","to":"2020-11-09"}}{"recentTrips":[],"metadata":{"from":"2020-11-13","to":"2020-11-19"}}{"recentTrips":[],"metadata":{"from":"2020-12-10","to":"2020-12-16"}}{"recentTrips":[],"metadata":{"from":"2020-12-24","to":"2020-12-30"}}# (tojota) ╭─root@sparrow ~/tojota/cache ‹master

calmjm commented 3 years ago

Fixed crash on empty parking information in https://github.com/calmjm/tojota/pull/20 . If your trips data remains empty too it probably means your car is not properly paired with your MyT account and you need to contact your Toyota dealer.