volkswagencarnet 4.4.70__tar.gz → 5.3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/.github/workflows/codeql-analysis.yml +5 -5
  2. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/.github/workflows/release.yaml +7 -5
  3. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/.github/workflows/snyk.yaml +2 -2
  4. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/.github/workflows/testrelease.yaml +9 -7
  5. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/.github/workflows/validate.yml +10 -28
  6. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/.pre-commit-config.yaml +1 -12
  7. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/PKG-INFO +16 -7
  8. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/README.md +11 -3
  9. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/pyproject.toml +0 -13
  10. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/requirements-test.txt +0 -3
  11. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/requirements.txt +0 -1
  12. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/setup.cfg +2 -28
  13. volkswagencarnet-5.3.3/tests/conftest.py +4 -0
  14. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/credentials.py.sample +1 -1
  15. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/dummy_test.py +4 -3
  16. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/connection.py +9 -3
  17. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/integration_test.py +11 -12
  18. volkswagencarnet-5.3.3/tests/vw_connection_test.py +97 -0
  19. volkswagencarnet-5.3.3/tests/vw_utilities_test.py +116 -0
  20. volkswagencarnet-5.3.3/tests/vw_vehicle_test.py +246 -0
  21. volkswagencarnet-5.3.3/volkswagencarnet/version.py +34 -0
  22. volkswagencarnet-5.3.3/volkswagencarnet/vw_connection.py +1245 -0
  23. volkswagencarnet-5.3.3/volkswagencarnet/vw_const.py +400 -0
  24. volkswagencarnet-5.3.3/volkswagencarnet/vw_dashboard.py +2785 -0
  25. volkswagencarnet-5.3.3/volkswagencarnet/vw_exceptions.py +43 -0
  26. volkswagencarnet-5.3.3/volkswagencarnet/vw_utilities.py +163 -0
  27. volkswagencarnet-5.3.3/volkswagencarnet/vw_vehicle.py +3633 -0
  28. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/volkswagencarnet.egg-info/PKG-INFO +16 -7
  29. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/volkswagencarnet.egg-info/SOURCES.txt +0 -2
  30. volkswagencarnet-4.4.70/.github/workflows/codecov.yaml +0 -35
  31. volkswagencarnet-4.4.70/tests/conftest.py +0 -8
  32. volkswagencarnet-4.4.70/tests/vw_connection_test.py +0 -178
  33. volkswagencarnet-4.4.70/tests/vw_exceptions_test.py +0 -14
  34. volkswagencarnet-4.4.70/tests/vw_utilities_test.py +0 -168
  35. volkswagencarnet-4.4.70/tests/vw_vehicle_test.py +0 -300
  36. volkswagencarnet-4.4.70/volkswagencarnet/version.py +0 -16
  37. volkswagencarnet-4.4.70/volkswagencarnet/vw_connection.py +0 -1046
  38. volkswagencarnet-4.4.70/volkswagencarnet/vw_const.py +0 -144
  39. volkswagencarnet-4.4.70/volkswagencarnet/vw_dashboard.py +0 -1494
  40. volkswagencarnet-4.4.70/volkswagencarnet/vw_exceptions.py +0 -7
  41. volkswagencarnet-4.4.70/volkswagencarnet/vw_utilities.py +0 -144
  42. volkswagencarnet-4.4.70/volkswagencarnet/vw_vehicle.py +0 -3157
  43. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/.github/CODEOWNERS +0 -0
  44. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/.github/dependabot.yml +0 -0
  45. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/.github/release-drafter.yml +0 -0
  46. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/.github/renovate.json +0 -0
  47. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/.github/workflows/publish.yaml +0 -0
  48. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/.github/workflows/validate_pr.yaml +0 -0
  49. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/.gitignore +0 -0
  50. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/LICENSE.txt +0 -0
  51. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/__init__.py +0 -0
  52. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/__init__.py +0 -0
  53. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/constants.py +0 -0
  54. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/mock_server.py +1 -1
  55. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/dummy_cookies.pickle +0 -0
  56. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/README.md +0 -0
  57. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/arteon_2023_diesel/capabilities.json +0 -0
  58. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/arteon_2023_diesel/last_trip.json +0 -0
  59. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/arteon_2023_diesel/parkingposition.json +0 -0
  60. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/arteon_2023_diesel/selectivestatus_by_app.json +0 -0
  61. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/egolf/README.md +0 -0
  62. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/egolf/capabilities.json +0 -0
  63. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/egolf/last_trip.json +0 -0
  64. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/egolf/parkingposition.json +0 -0
  65. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/egolf/selectivestatus_by_app.json +0 -0
  66. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/eup_electric/capabilities.json +0 -0
  67. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/eup_electric/last_trip.json +0 -0
  68. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/eup_electric/parkingposition.json +0 -0
  69. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/eup_electric/selectivestatus_by_app.json +0 -0
  70. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/golf_gte_hybrid/capabilities.json +0 -0
  71. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/golf_gte_hybrid/last_trip.json +0 -0
  72. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/golf_gte_hybrid/selectivestatus_by_app.json +0 -0
  73. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/status.json +0 -0
  74. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/timer.json +0 -0
  75. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/tests/fixtures/resources/responses/timer_without_settings.json +0 -0
  76. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/volkswagencarnet/__init__.py +0 -0
  77. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/volkswagencarnet.egg-info/dependency_links.txt +0 -0
  78. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/volkswagencarnet.egg-info/requires.txt +0 -0
  79. {volkswagencarnet-4.4.70 → volkswagencarnet-5.3.3}/volkswagencarnet.egg-info/top_level.txt +0 -0
@@ -22,19 +22,19 @@ jobs:
22
22
  fail-fast: false
23
23
  matrix:
24
24
  language: ["python"]
25
- python-version: ["3.8", "3.9", "3.10", "3.11"]
25
+ python-version: ["3.11", "3.12"]
26
26
 
27
27
  steps:
28
28
  - name: Checkout repository
29
- uses: actions/checkout@v4
29
+ uses: actions/checkout@v6
30
30
 
31
31
  # Initializes the CodeQL tools for scanning.
32
32
  - name: Set up Python
33
- uses: actions/setup-python@v5
33
+ uses: actions/setup-python@v6
34
34
  with:
35
35
  python-version: ${{ matrix.python-version }}
36
36
  - name: Initialize CodeQL
37
- uses: github/codeql-action/init@v3
37
+ uses: github/codeql-action/init@v4
38
38
  with:
39
39
  languages: ${{ matrix.language }}
40
40
  queries: security-and-quality
@@ -45,4 +45,4 @@ jobs:
45
45
 
46
46
 
47
47
  - name: Perform CodeQL Analysis
48
- uses: github/codeql-action/analyze@v3
48
+ uses: github/codeql-action/analyze@v4
@@ -9,12 +9,15 @@ jobs:
9
9
  if: "!github.event.release.prerelease"
10
10
  name: Upload Package to PyPi Repository
11
11
  runs-on: ubuntu-latest
12
+ environment: release
13
+ permissions:
14
+ id-token: write
12
15
  steps:
13
16
  - name: Checkout code
14
- uses: actions/checkout@v4
17
+ uses: actions/checkout@v6
15
18
 
16
19
  - name: Set up Python
17
- uses: actions/setup-python@v5
20
+ uses: actions/setup-python@v6
18
21
  with:
19
22
  python-version: "3.x"
20
23
 
@@ -32,7 +35,6 @@ jobs:
32
35
 
33
36
  - name: Publish package to PyPI
34
37
  if: startsWith(github.ref, 'refs/tags')
35
- uses: pypa/gh-action-pypi-publish@master
38
+ uses: pypa/gh-action-pypi-publish@release/v1
36
39
  with:
37
- password: ${{ secrets.PYPI_TOKEN_PROD }}
38
- print_hash: true
40
+ print-hash: true
@@ -6,7 +6,7 @@ jobs:
6
6
  runs-on: ubuntu-latest
7
7
  steps:
8
8
  - name: Checkout repository
9
- uses: actions/checkout@v4
9
+ uses: actions/checkout@v6
10
10
 
11
11
  - name: Run Snyk to check for vulnerabilities
12
12
  uses: snyk/actions/python@master
@@ -17,6 +17,6 @@ jobs:
17
17
  args: --sarif-file-output=snyk.sarif
18
18
 
19
19
  - name: Upload result to GitHub Code Scanning
20
- uses: github/codeql-action/upload-sarif@v3
20
+ uses: github/codeql-action/upload-sarif@v4
21
21
  with:
22
22
  sarif_file: snyk.sarif
@@ -9,12 +9,15 @@ jobs:
9
9
  build:
10
10
  name: Upload Package to PyPi Test Repository
11
11
  runs-on: ubuntu-latest
12
+ environment: testrelease
13
+ permissions:
14
+ id-token: write
12
15
  steps:
13
16
  - name: Checkout code
14
- uses: actions/checkout@v4
17
+ uses: actions/checkout@v6
15
18
 
16
19
  - name: Set up Python
17
- uses: actions/setup-python@v5
20
+ uses: actions/setup-python@v6
18
21
  with:
19
22
  python-version: "3.x"
20
23
 
@@ -31,9 +34,8 @@ jobs:
31
34
  python -m setuptools_scm --strip-dev
32
35
 
33
36
  - name: Publish package to Test PyPI
34
- uses: pypa/gh-action-pypi-publish@master
37
+ uses: pypa/gh-action-pypi-publish@release/v1
35
38
  with:
36
- password: ${{ secrets.PYPI_TOKEN_TEST }}
37
- repository_url: https://test.pypi.org/legacy/
38
- print_hash: true
39
- skip_existing: true
39
+ repository-url: https://test.pypi.org/legacy/
40
+ print-hash: true
41
+ skip-existing: true
@@ -1,4 +1,4 @@
1
- # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
1
+ # This workflow will install Python dependencies, run tests and ruff with a variety of Python versions
2
2
  # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3
3
 
4
4
  name: Validate
@@ -14,52 +14,34 @@ on:
14
14
  - master
15
15
 
16
16
  jobs:
17
- lint:
18
- name: Lint
17
+ ruff:
18
+ name: Ruff
19
19
  runs-on: ubuntu-latest
20
20
 
21
21
  steps:
22
22
  - name: Checkout code
23
- uses: actions/checkout@v4
23
+ uses: actions/checkout@v6
24
24
 
25
- - name: Set up Python 3.11
26
- uses: actions/setup-python@v5
25
+ - name: Check ruff
26
+ uses: chartboost/ruff-action@v1
27
27
  with:
28
- python-version: "3.11"
29
-
30
- - name: Install dependencies
31
- run: |
32
- python -m pip install --upgrade pip
33
- pip install flake8 black
34
- if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
35
-
36
- - name: Lint with flake8
37
- run: |
38
- # stop the build if there are Python syntax errors or undefined names
39
- flake8 . --select=E9,F63,F7,F82,F841,E266
40
- # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
41
- flake8 . --exit-zero --max-complexity=10 --max-line-length=127
42
-
43
- - name: Lint with black
44
- #uses: psf/black@stable
45
- run: |
46
- black --check --diff --color .
28
+ args: 'format --diff'
47
29
 
48
30
  test-n-build:
49
31
  name: Test and Build
50
32
  runs-on: ubuntu-latest
51
33
  strategy:
52
34
  matrix:
53
- python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
35
+ python-version: ["3.11", "3.12"]
54
36
 
55
37
  steps:
56
38
  - name: Checkout code
57
- uses: actions/checkout@v4
39
+ uses: actions/checkout@v6
58
40
  with:
59
41
  fetch-depth: 0
60
42
 
61
43
  - name: Set up Python ${{ matrix.python-version }}
62
- uses: actions/setup-python@v5
44
+ uses: actions/setup-python@v6
63
45
  with:
64
46
  python-version: ${{ matrix.python-version }}
65
47
 
@@ -1,7 +1,7 @@
1
1
  # See https://pre-commit.com for more information
2
2
  # See https://pre-commit.com/hooks.html for more hooks
3
3
  default_language_version:
4
- python: python3.9
4
+ python: python3.11
5
5
 
6
6
  repos:
7
7
  - repo: https://github.com/pre-commit/pre-commit-hooks
@@ -18,17 +18,6 @@ repos:
18
18
  - id: requirements-txt-fixer
19
19
  - id: trailing-whitespace
20
20
 
21
- - repo: https://github.com/psf/black
22
- rev: '22.10.0'
23
- hooks:
24
- - id: black
25
-
26
- - repo: https://github.com/pycqa/flake8
27
- rev: '4.0.1'
28
- hooks:
29
- - id: flake8
30
- additional_dependencies: [ flake8-docstrings ]
31
-
32
21
  - repo: https://github.com/asottile/pyupgrade
33
22
  rev: v2.31.0
34
23
  hooks:
@@ -1,7 +1,7 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: volkswagencarnet
3
- Version: 4.4.70
4
- Summary: Communicate with Volkswagen WeConnect
3
+ Version: 5.3.3
4
+ Summary: Communicate with Volkswagen Connect
5
5
  Home-page: https://github.com/robinostlund/volkswagencarnet
6
6
  Author: Robin Ostlund
7
7
  Author-email: me@robinostlund.name
@@ -10,22 +10,25 @@ Project-URL: Bug Tracker, https://github.com/robinostlund/volkswagencarnet/issue
10
10
  Classifier: Programming Language :: Python :: 3
11
11
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
12
12
  Classifier: Operating System :: OS Independent
13
- Requires-Python: >=3.7
13
+ Requires-Python: >=3.11
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE.txt
16
16
  Requires-Dist: lxml
17
17
  Requires-Dist: beautifulsoup4
18
18
  Requires-Dist: aiohttp
19
19
  Requires-Dist: pyjwt
20
+ Dynamic: license-file
20
21
 
21
22
  # Volkswagen Carnet
22
23
 
23
24
  [![buy me a coffee](https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png)](https://www.buymeacoffee.com/robinostlund)
24
25
 
26
+ [![buy me a coffee](https://raw.githubusercontent.com/robinostlund/homeassistant-volkswagencarnet/master/resources/stickpin_kofi.jpeg)](https://ko-fi.com/stickpin)
27
+
25
28
  ![Release](https://img.shields.io/github/workflow/status/robinostlund/volkswagencarnet/Release)
26
29
  ![PyPi](https://img.shields.io/pypi/v/volkswagencarnet)
27
30
  ![Version](https://img.shields.io/github/v/release/robinostlund/volkswagencarnet)
28
- ![CodeStyle](https://img.shields.io/badge/code%20style-black-black)
31
+ ![CodeStyle](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)
29
32
  ![Known Vulnerabilities](https://snyk.io/test/github/robinostlund/volkswagencarnet/badge.svg)
30
33
  [![CodeQL](https://github.com/robinostlund/volkswagencarnet/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/robinostlund/volkswagencarnet/actions/workflows/codeql-analysis.yml)
31
34
  [![codecov](https://codecov.io/gh/robinostlund/volkswagencarnet/branch/master/graph/badge.svg?token=NH1Q1GH4I3)](https://codecov.io/gh/robinostlund/volkswagencarnet)
@@ -37,7 +40,7 @@ Requires-Dist: pyjwt
37
40
 
38
41
  ## Help Wanted
39
42
 
40
- As i don't have a car with we connect anymore i would appreciate if it would be possible to get help to keep this repository maintained. So if you feel that you have some time over and is interested in helping out with this. Please feel to contact me! Thanks
43
+ As i don't have a car with Volkswagen Connect anymore i would appreciate if it would be possible to get help to keep this repository maintained. So if you feel that you have some time over and is interested in helping out with this. Please feel to contact me! Thanks
41
44
 
42
45
  ## Information
43
46
 
@@ -47,6 +50,7 @@ No licence, public domain, no guarantees, feel free to use for anything. Please
47
50
 
48
51
  ## Thanks to
49
52
 
53
+ - [stickpin](https://github.com/stickpin)
50
54
  - [Wez3](https://github.com/wez3)
51
55
  - [Reneboer](https://github.com/reneboer)
52
56
  - [Tubalainen](https://github.com/tubalainen)
@@ -124,7 +128,12 @@ RESOURCES = [
124
128
  'trip_last_average_electric_consumption',
125
129
  'trip_last_average_fuel_consumption',
126
130
  'trip_last_duration',
127
- 'trip_last_length'
131
+ 'trip_last_length',
132
+ 'trip_refuel_average_speed',
133
+ 'trip_refuel_average_electric_consumption',
134
+ 'trip_refuel_average_fuel_consumption',
135
+ 'trip_refuel_duration',
136
+ 'trip_refuel_length'
128
137
  ]
129
138
 
130
139
  def is_enabled(attr):
@@ -2,10 +2,12 @@
2
2
 
3
3
  [![buy me a coffee](https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png)](https://www.buymeacoffee.com/robinostlund)
4
4
 
5
+ [![buy me a coffee](https://raw.githubusercontent.com/robinostlund/homeassistant-volkswagencarnet/master/resources/stickpin_kofi.jpeg)](https://ko-fi.com/stickpin)
6
+
5
7
  ![Release](https://img.shields.io/github/workflow/status/robinostlund/volkswagencarnet/Release)
6
8
  ![PyPi](https://img.shields.io/pypi/v/volkswagencarnet)
7
9
  ![Version](https://img.shields.io/github/v/release/robinostlund/volkswagencarnet)
8
- ![CodeStyle](https://img.shields.io/badge/code%20style-black-black)
10
+ ![CodeStyle](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)
9
11
  ![Known Vulnerabilities](https://snyk.io/test/github/robinostlund/volkswagencarnet/badge.svg)
10
12
  [![CodeQL](https://github.com/robinostlund/volkswagencarnet/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/robinostlund/volkswagencarnet/actions/workflows/codeql-analysis.yml)
11
13
  [![codecov](https://codecov.io/gh/robinostlund/volkswagencarnet/branch/master/graph/badge.svg?token=NH1Q1GH4I3)](https://codecov.io/gh/robinostlund/volkswagencarnet)
@@ -17,7 +19,7 @@
17
19
 
18
20
  ## Help Wanted
19
21
 
20
- As i don't have a car with we connect anymore i would appreciate if it would be possible to get help to keep this repository maintained. So if you feel that you have some time over and is interested in helping out with this. Please feel to contact me! Thanks
22
+ As i don't have a car with Volkswagen Connect anymore i would appreciate if it would be possible to get help to keep this repository maintained. So if you feel that you have some time over and is interested in helping out with this. Please feel to contact me! Thanks
21
23
 
22
24
  ## Information
23
25
 
@@ -27,6 +29,7 @@ No licence, public domain, no guarantees, feel free to use for anything. Please
27
29
 
28
30
  ## Thanks to
29
31
 
32
+ - [stickpin](https://github.com/stickpin)
30
33
  - [Wez3](https://github.com/wez3)
31
34
  - [Reneboer](https://github.com/reneboer)
32
35
  - [Tubalainen](https://github.com/tubalainen)
@@ -104,7 +107,12 @@ RESOURCES = [
104
107
  'trip_last_average_electric_consumption',
105
108
  'trip_last_average_fuel_consumption',
106
109
  'trip_last_duration',
107
- 'trip_last_length'
110
+ 'trip_last_length',
111
+ 'trip_refuel_average_speed',
112
+ 'trip_refuel_average_electric_consumption',
113
+ 'trip_refuel_average_fuel_consumption',
114
+ 'trip_refuel_duration',
115
+ 'trip_refuel_length'
108
116
  ]
109
117
 
110
118
  def is_enabled(attr):
@@ -10,19 +10,6 @@ build-backend = "setuptools.build_meta"
10
10
  fallback_version = "0.0.0"
11
11
  write_to = "volkswagencarnet/version.py"
12
12
 
13
- [tool.black]
14
- line-length = 120
15
- target-version = ['py37', 'py38', 'py39', 'py310']
16
- include = '\.pyi?$'
17
- extend-exclude = '''
18
- /(
19
- # The following are specific to Black, you probably don't want those.
20
- | blib2to3
21
- | tests/data
22
- | profiling
23
- )/
24
- '''
25
-
26
13
  [tool.pytest.ini_options]
27
14
  minversion = "6.0"
28
15
  addopts = "-ra"
@@ -1,7 +1,4 @@
1
1
  -r requirements.txt
2
- black
3
- flake8
4
- flake8-docstrings
5
2
  freezegun>=1.0.0
6
3
  pre-commit
7
4
  pytest>=7.0.0
@@ -1,5 +1,4 @@
1
1
  aiohttp
2
2
  beautifulsoup4
3
- cryptography
4
3
  lxml
5
4
  pyjwt
@@ -2,7 +2,7 @@
2
2
  name = volkswagencarnet
3
3
  author = Robin Ostlund
4
4
  author_email = me@robinostlund.name
5
- description = Communicate with Volkswagen WeConnect
5
+ description = Communicate with Volkswagen Connect
6
6
  long_description = file: README.md
7
7
  long_description_content_type = text/markdown
8
8
  url = https://github.com/robinostlund/volkswagencarnet
@@ -23,7 +23,7 @@ install_requires =
23
23
  package_dir =
24
24
  = .
25
25
  packages = find:
26
- python_requires = >= 3.7
26
+ python_requires = >= 3.11
27
27
 
28
28
  [options.packages.find]
29
29
  where = .
@@ -31,32 +31,6 @@ exclude =
31
31
  tests
32
32
  tests.*
33
33
 
34
- [flake8]
35
- ignore =
36
- E722,
37
- I201,
38
- W503,
39
- CFQ001,
40
- CFQ002,
41
- E501,
42
- W503,
43
- E203,
44
- D202,
45
- W504
46
- filename =
47
- *.py
48
- exclude =
49
- .git,
50
- __pycache__,
51
- *.txt,
52
- *.md,
53
- *.cfg
54
- max_line_length = 120
55
- count = True
56
- inline_quotes = double
57
- show_source = True
58
- statistics = True
59
-
60
34
  [pycodestyle]
61
35
  max_line_length = 120
62
36
  statistics = True
@@ -0,0 +1,4 @@
1
+ """Configure tests."""
2
+
3
+ pytest_plugins = ["pytest_cov"]
4
+ pytest_plugins.append("tests.fixtures.connection")
@@ -2,5 +2,5 @@
2
2
  # Oh, and replace the data in credentials.py with your own
3
3
  spin = '1234'
4
4
  username = 'john.doe@localhost.localnet'
5
- pasword = 'passw0rd'
5
+ password = 'passw0rd'
6
6
  vin = 'WVWZZXXXXX1234567'
@@ -1,8 +1,7 @@
1
1
  """Dummy tests. Might be removed once there are proper ones."""
2
2
 
3
- import pytest
4
3
  from aiohttp import ClientSession
5
-
4
+ import pytest
6
5
  from volkswagencarnet import vw_connection
7
6
 
8
7
 
@@ -10,6 +9,8 @@ from volkswagencarnet import vw_connection
10
9
  async def test_volkswagencarnet():
11
10
  """Dummy test to ensure logged in status is false by default."""
12
11
  async with ClientSession() as session:
13
- connection = vw_connection.Connection(session, "test@example.com", "test_password")
12
+ connection = vw_connection.Connection(
13
+ session, "test@example.com", "test_password"
14
+ )
14
15
  # if await connection._login():
15
16
  assert connection.logged_in is False
@@ -2,11 +2,11 @@
2
2
 
3
3
  import os
4
4
 
5
+ from aiohttp import ClientSession, CookieJar
5
6
  import pytest
6
7
  import pytest_asyncio
7
- from aiohttp import CookieJar, ClientSession
8
-
9
8
  from volkswagencarnet.vw_connection import Connection
9
+
10
10
  from .constants import resource_path
11
11
 
12
12
 
@@ -23,4 +23,10 @@ async def session():
23
23
  @pytest.fixture
24
24
  def connection(session):
25
25
  """Real connection for integration tests."""
26
- return Connection(session=session, username="", password="", country="DE", interval=999, fulldebug=True)
26
+ return Connection(
27
+ session=session,
28
+ username="",
29
+ password="",
30
+ country="DE",
31
+ interval=999,
32
+ )
@@ -1,5 +1,4 @@
1
- """
2
- Integration tests.
1
+ """Integration tests.
3
2
 
4
3
  These tests use actual credentials, and should thus be used with care.
5
4
  Credentials have to be specified in credentials.py.
@@ -7,22 +6,22 @@ Credentials have to be specified in credentials.py.
7
6
 
8
7
  import logging
9
8
 
10
- import pytest
11
9
  from aiohttp import ClientSession
12
-
10
+ import pytest
13
11
  from volkswagencarnet import vw_connection
14
12
 
15
13
  try:
16
- from credentials import username, password, spin, vin
14
+ from tests.credentials import password, spin, username, vin
17
15
  except ImportError:
18
16
  username = password = spin = vin = None
19
17
 
20
18
 
21
19
  @pytest.mark.skipif(
22
- username is None or password is None, reason="Username or password is not set. Check credentials.py.sample"
20
+ username is None or password is None,
21
+ reason="Username or password is not set. Check credentials.py.sample",
23
22
  )
24
23
  @pytest.mark.asyncio
25
- async def test_successful_login():
24
+ async def test_successful_login() -> None:
26
25
  """Test that login succeeds."""
27
26
  async with ClientSession() as session:
28
27
  connection = vw_connection.Connection(session, username, password)
@@ -31,14 +30,14 @@ async def test_successful_login():
31
30
 
32
31
 
33
32
  @pytest.mark.skipif(
34
- username is None or password is None, reason="Username or password is not set. Check credentials.py.sample"
33
+ username is None or password is None,
34
+ reason="Username or password is not set. Check credentials.py.sample",
35
35
  )
36
36
  @pytest.mark.asyncio
37
37
  @pytest.mark.skip("Not yet implemented")
38
- async def test_spin_action():
39
- """
40
- Test something that uses s-pin.
38
+ async def test_spin_action() -> None:
39
+ """Test something that uses s-pin.
41
40
 
42
41
  Not yet implemented...
43
42
  """
44
- logging.getLogger().debug(f"using vin: {vin} and s-pin: {spin}")
43
+ logging.getLogger().debug("using vin: %s and s-pin: %s", vin, spin)
@@ -0,0 +1,97 @@
1
+ """Tests for main connection class."""
2
+
3
+ import sys
4
+ from unittest import IsolatedAsyncioTestCase
5
+ from unittest.mock import MagicMock, patch
6
+
7
+ import aiohttp
8
+ from aiohttp import client_exceptions
9
+ import pytest
10
+ from volkswagencarnet import vw_connection
11
+ from volkswagencarnet.vw_connection import Connection
12
+
13
+
14
+ class TwoVehiclesConnection(Connection):
15
+ """Connection that return two vehicles."""
16
+
17
+ ALLOW_RATE_LIMIT_DELAY = False
18
+
19
+ # noinspection PyUnusedLocal
20
+ # noinspection PyMissingConstructor
21
+ def __init__(self, sess, username="", password="", **kwargs):
22
+ """Init."""
23
+ super().__init__(session=sess, username=username, password=password)
24
+
25
+ async def doLogin(self, tries=1):
26
+ """No-op update."""
27
+ return True
28
+
29
+ async def update(self):
30
+ """No-op update."""
31
+ return True
32
+
33
+ @property
34
+ def vehicles(self):
35
+ """Return the vehicles."""
36
+ vehicle1 = vw_connection.Vehicle(None, "vin1")
37
+ vehicle2 = vw_connection.Vehicle(None, "vin2")
38
+ return [vehicle1, vehicle2]
39
+
40
+
41
+ @pytest.mark.skipif(
42
+ condition=sys.version_info < (3, 11), reason="Test incompatible with Python < 3.11"
43
+ )
44
+ def test_clear_cookies(connection) -> None:
45
+ """Check that we can clear old cookies."""
46
+ assert len(connection._session._cookie_jar._cookies) > 0
47
+ connection._clear_cookies()
48
+ assert len(connection._session._cookie_jar._cookies) == 0
49
+
50
+
51
+ class SendCommandsTest(IsolatedAsyncioTestCase):
52
+ """Test command sending."""
53
+
54
+ async def test_set_schedule(self):
55
+ """Test set schedule."""
56
+ pass
57
+
58
+
59
+ class RateLimitTest(IsolatedAsyncioTestCase):
60
+ """Test that rate limiting towards VW works."""
61
+
62
+ invocations = 0
63
+
64
+ async def rateLimitedFunction(self, url, vin=""):
65
+ """Limit calls test function."""
66
+ ri = MagicMock(aiohttp.RequestInfo)
67
+ e = client_exceptions.ClientResponseError(request_info=ri, history=tuple([]))
68
+ e.status = 429
69
+ self.invocations = self.invocations + 1
70
+ raise e
71
+
72
+ @pytest.mark.asyncio
73
+ @pytest.mark.skipif(
74
+ condition=sys.version_info < (3, 11),
75
+ reason="Test incompatible with Python < 3.11",
76
+ )
77
+ @patch(
78
+ "volkswagencarnet.vw_connection.Connection",
79
+ spec_set=vw_connection.Connection,
80
+ new=TwoVehiclesConnection,
81
+ )
82
+ @patch("volkswagencarnet.vw_connection.MAX_RETRIES_ON_RATE_LIMIT", 1)
83
+ async def test_rate_limit(self):
84
+ """Test rate limiting functionality."""
85
+
86
+ from unittest.mock import AsyncMock
87
+
88
+ sess = AsyncMock()
89
+
90
+ # noinspection PyArgumentList
91
+ conn = vw_connection.Connection(sess, "", "")
92
+
93
+ self.invocations = 0
94
+ with patch.object(conn, "_request", self.rateLimitedFunction):
95
+ res = await conn.get("foo")
96
+ assert res == {"status_code": 429}
97
+ assert self.invocations == vw_connection.MAX_RETRIES_ON_RATE_LIMIT + 1