DurgNomis-drol / mytoyota

Python client for Toyota Connected Services API
MIT License
81 stars 33 forks source link

SummaryType error if using simple_client_example.py #273

Closed dvogt23 closed 10 months ago

dvogt23 commented 11 months ago

Describe the bug Getting following error if using simple_client_example.py:

Traceback (most recent call last):
  File "/home/pi/toyota/simple_client_example.py", line 8, in <module>
    from mytoyota.models.summary import SummaryType
ModuleNotFoundError: No module named 'mytoyota.models.summary'

To Reproduce Python 3.9.2

Run: python simple_client_example.py

CM000n commented 11 months ago

Hello @dvogt23, thank you for reporting. Unfortunately, I cannot reproduce the error. 😞 Which version of the mytoyota package are you using and how did you install it? Directly the latest version from the master of the repo or via pip the latest Pypi release version?

dvogt23 commented 10 months ago

Hello @CM000n I did it with: python -m pip install "mytoyota @ git+https://github.com/DurgNomis-drol/mytoyota@master"

CM000n commented 10 months ago

Did you select the correct Python environment when calling simple_client_example.py? Sorry if I'm asking such a stupid question, but I really can't reproduce this behavior.

Did you possibly use the python3 instead of python command at some point and got confused?

At least this is how it looks for me:

~
❯ mkdir mt_test

~
❯ cd mt_test

~/mt_test
❯ ls -l -a
total 8
drwxr-xr-x  2 simon simon 4096 Jan  7 19:45 .
drwxr-x--- 13 simon simon 4096 Jan  7 19:45 ..

~/mt_test
❯ python -m venv mytoyota
zsh: command not found: python

~/mt_test
❯ python3 -m venv mytoyota

~/mt_test took 6s
❯ source mytoyota/bin/activate

~/mt_test via  v3.10.12 (mytoyota)
❯ python3 -m pip install "mytoyota @ git+https://github.com/DurgNomis-drol/mytoyota@master"
Collecting mytoyota@ git+https://github.com/DurgNomis-drol/mytoyota@master
  Cloning https://github.com/DurgNomis-drol/mytoyota (to revision master) to /tmp/pip-install-nhlqyxrb/mytoyota_b358086e20dd4a239c68cceede5eeb39
  Running command git clone --filter=blob:none --quiet https://github.com/DurgNomis-drol/mytoyota /tmp/pip-install-nhlqyxrb/mytoyota_b358086e20dd4a239c68cceede5eeb39
  Resolved https://github.com/DurgNomis-drol/mytoyota to commit d7237a2f76e81c5d6764ebde74464b8ee7fc6b13
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting arrow<2.0,>=1.1
  Downloading arrow-1.3.0-py3-none-any.whl (66 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.4/66.4 KB 1.1 MB/s eta 0:00:00
Collecting httpx>=0.18.1
  Downloading httpx-0.26.0-py3-none-any.whl (75 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 75.9/75.9 KB 4.6 MB/s eta 0:00:00
Collecting hishel<0.0.20,>=0.0.19
  Downloading hishel-0.0.19-py3-none-any.whl (30 kB)
Collecting pydantic<2.0.0,>=1.10.0
  Downloading pydantic-1.10.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.1/3.1 MB 18.2 MB/s eta 0:00:00
Collecting pyjwt<3.0.0,>=2.8.0
  Downloading PyJWT-2.8.0-py3-none-any.whl (22 kB)
Collecting langcodes<4.0,>=3.1
  Downloading langcodes-3.3.0-py3-none-any.whl (181 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 181.6/181.6 KB 12.6 MB/s eta 0:00:00
Collecting importlib-metadata<8.0.0,>=7.0.1
  Downloading importlib_metadata-7.0.1-py3-none-any.whl (23 kB)
Collecting types-python-dateutil>=2.8.10
  Downloading types_python_dateutil-2.8.19.20240106-py3-none-any.whl (9.7 kB)
Collecting python-dateutil>=2.7.0
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 KB 14.5 MB/s eta 0:00:00
Collecting idna
  Downloading idna-3.6-py3-none-any.whl (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.6/61.6 KB 6.0 MB/s eta 0:00:00
Collecting certifi
  Downloading certifi-2023.11.17-py3-none-any.whl (162 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 162.5/162.5 KB 10.3 MB/s eta 0:00:00
Collecting anyio
  Downloading anyio-4.2.0-py3-none-any.whl (85 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 85.5/85.5 KB 8.0 MB/s eta 0:00:00
Collecting sniffio
  Downloading sniffio-1.3.0-py3-none-any.whl (10 kB)
Collecting httpcore==1.*
  Downloading httpcore-1.0.2-py3-none-any.whl (76 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 76.9/76.9 KB 4.7 MB/s eta 0:00:00
Collecting h11<0.15,>=0.13
  Downloading h11-0.14.0-py3-none-any.whl (58 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.3/58.3 KB 4.4 MB/s eta 0:00:00
Collecting zipp>=0.5
  Using cached zipp-3.17.0-py3-none-any.whl (7.4 kB)
Collecting typing-extensions>=4.2.0
  Downloading typing_extensions-4.9.0-py3-none-any.whl (32 kB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting exceptiongroup>=1.0.2
  Downloading exceptiongroup-1.2.0-py3-none-any.whl (16 kB)
Building wheels for collected packages: mytoyota
  Building wheel for mytoyota (pyproject.toml) ... done
  Created wheel for mytoyota: filename=mytoyota-1.1.2-py3-none-any.whl size=41288 sha256=7e9fc9ab5c0502afad09c62ed829cbba08fd819ee14cc0273c60851430293819
  Stored in directory: /tmp/pip-ephem-wheel-cache-s_alh44g/wheels/8a/ed/05/57b406d5bc7c26871c26d4b4ff0298c891bdf6d2d0d4ed9718
Successfully built mytoyota
Installing collected packages: zipp, typing-extensions, types-python-dateutil, sniffio, six, pyjwt, langcodes, idna, h11, exceptiongroup, certifi, python-dateutil, pydantic, importlib-metadata, httpcore, anyio, httpx, arrow, hishel, mytoyota
Successfully installed anyio-4.2.0 arrow-1.3.0 certifi-2023.11.17 exceptiongroup-1.2.0 h11-0.14.0 hishel-0.0.19 httpcore-1.0.2 httpx-0.26.0 idna-3.6 importlib-metadata-7.0.1 langcodes-3.3.0 mytoyota-1.1.2 pydantic-1.10.13 pyjwt-2.8.0 python-dateutil-2.8.2 six-1.16.0 sniffio-1.3.0 types-python-dateutil-2.8.19.20240106 typing-extensions-4.9.0 zipp-3.17.0

~/mt_test via  v3.10.12 (mytoyota) took 14s
❯ curl -LO https://raw.githubusercontent.com/GitOldGrumpy/mytoyota/master/simple_client_example.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2187  100  2187    0     0   5339      0 --:--:-- --:--:-- --:--:--  5347

~/mt_test via  v3.10.12 (mytoyota)
❯ touch credentials.json

~/mt_test via  v3.10.12 (mytoyota)
❯ ls -l -a
total 16
drwxr-xr-x  3 simon simon 4096 Jan  7 19:47 .
drwxr-x--- 13 simon simon 4096 Jan  7 19:48 ..
-rw-r--r--  1 simon simon    0 Jan  7 19:47 credentials.json
drwxr-xr-x  5 simon simon 4096 Jan  7 19:46 mytoyota
-rw-r--r--  1 simon simon 2187 Jan  7 19:47 simple_client_example.py

~/mt_test via  v3.10.12 (mytoyota)
❯ nano credentials.json

~/mt_test via  v3.10.12 (mytoyota) took 48s
❯ python3 simple_client_example.py
Logging in...
Retrieving cars...
('Dashboard: odometer=19405.422 fuel_level=30 battery_level=None '
 'fuel_range=116.818 battery_range=None battery_range_with_ac=None '
 'range=116.818 charging_status=None remaining_charge_time=None '
 'warning_lights=[]')
...
dvogt23 commented 10 months ago

Ok, it works with your instructions, seems like smthg wrong with my old env 🤔

Thanks for your help :))