calmjm / tojota

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

Problem with statistics.py in 2021 #18

Closed mysliwiec-tech closed 3 years ago

mysliwiec-tech commented 3 years ago

I have been able to get the data using this script in 2020, so I suspect there is an issue with a new year that had started today.

Traceback (most recent call last):
  File "statistics.py", line 117, in <module>
    sys.exit(main())
  File "statistics.py", line 109, in main
    parse_daily_driving_statistics(myt, data)
  File "statistics.py", line 48, in parse_daily_driving_statistics
    date = pendulum.from_format(f'{year} {day_of_year}', 'YYYY DDDD', tz=myt.config_data['timezone'])
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pendulum/__init__.py", line 259, in from_format
    parts = _formatter.parse(string, fmt, now(), locale=locale)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pendulum/formatting/formatter.py", line 413, in parse
    raise ValueError("String does not match format {}".format(fmt))
ValueError: String does not match format YYYY DDDD
calmjm commented 3 years ago

There was issue in formatting the day of the year as it started from the one again. Fixed in https://github.com/calmjm/tojota/pull/23.