-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump abatilo/actions-poetry from 2.3.0 to 2.4.0 (#267)
* Bump abatilo/actions-poetry from 2.3.0 to 2.4.0 Bumps [abatilo/actions-poetry](https://github.com/abatilo/actions-poetry) from 2.3.0 to 2.4.0. - [Release notes](https://github.com/abatilo/actions-poetry/releases) - [Changelog](https://github.com/abatilo/actions-poetry/blob/master/.releaserc) - [Commits](abatilo/actions-poetry@v2.3.0...v2.4.0) --- updated-dependencies: - dependency-name: abatilo/actions-poetry dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * use importlib_metadata as a dependency across all Python versions * Update README.md * Update release drafter to current labels * using ruff as linter and formatter * remove unused pylint stuff * fix init test --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Simon Hörrle <[email protected]>
- Loading branch information
1 parent
2db3e9a
commit e12475e
Showing
39 changed files
with
497 additions
and
742 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,89 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.4.0 | ||
- repo: local | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-json | ||
name: "✅ Check JSON files" | ||
language: system | ||
types: [json] | ||
entry: poetry run check-json | ||
- id: check-toml | ||
name: "✅ Check TOML files" | ||
language: system | ||
types: [toml] | ||
entry: poetry run check-toml | ||
- id: check-yaml | ||
name: "✅ Check YAML files" | ||
language: system | ||
types: [yaml] | ||
entry: poetry run check-yaml | ||
- id: check-json | ||
name: "📁 Check for large files" | ||
language: system | ||
entry: poetry run check-added-large-files | ||
- id: check-json | ||
name: "🐛 Check for forgotten debug statemens" | ||
language: system | ||
types: [python] | ||
entry: poetry run debug-statement-hook | ||
- id: check-merge-conflict | ||
- id: debug-statements | ||
name: "💥 Check for merge conflicts" | ||
language: system | ||
types: [text] | ||
entry: poetry run check-merge-conflict | ||
- id: check-symlinks | ||
name: "🔗 Check for broken symlinks" | ||
language: system | ||
types: [symlink] | ||
entry: poetry run check-symlinks | ||
- id: codespell | ||
name: "💭 Check for code spelling" | ||
entry: poetry run codespell --write-changes --skip="./*" | ||
language: system | ||
pass_filenames: false | ||
always_run: true | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- id: no-commit-to-branch | ||
args: [--branch, master, --branch, main] | ||
- repo: https://github.com/python-poetry/poetry | ||
rev: "1.3" | ||
hooks: | ||
- id: poetry-lock | ||
args: ["--check"] | ||
- repo: local | ||
hooks: | ||
- id: black | ||
name: black | ||
entry: poetry run black | ||
name: "🔚 Fix End of Files" | ||
language: system | ||
types: [python] | ||
require_serial: true | ||
- id: isort | ||
name: isort | ||
entry: poetry run isort | ||
types: [text] | ||
entry: poetry run end-of-file-fixer | ||
stages: [commit, push, manual] | ||
- id: end-of-file-fixer | ||
name: "⬜ Fix trailing whitespaces" | ||
language: system | ||
types: [text] | ||
entry: poetry run end-of-file-fixer | ||
stages: [commit, push, manual] | ||
- id: ruff-check | ||
name: "🐶 Ruff Linter" | ||
language: system | ||
types: [python] | ||
entry: poetry run ruff check --fix | ||
require_serial: true | ||
- id: flake8 | ||
name: flake8 | ||
entry: poetry run flake8 | ||
stages: [commit, push, manual] | ||
- id: ruff-format | ||
name: "🐶 Ruff Formatter" | ||
language: system | ||
types: [python] | ||
- id: pylint | ||
name: pylint | ||
entry: poetry run pylint | ||
entry: poetry run ruff format | ||
require_serial: true | ||
stages: [commit, push, manual] | ||
- id: poetry pyproject check | ||
name: "📜 Check pyproject with Poetry" | ||
language: system | ||
types: [python] | ||
- id: codespell | ||
name: codespell | ||
entry: poetry run codespell --write-changes --skip="./*" | ||
entry: poetry check | ||
pass_filenames: false | ||
always_run: true | ||
- id: no-commit-to-branch | ||
name: "🛑 Don't commit to main branch" | ||
language: system | ||
entry: poetry run no-commit-to-branch | ||
pass_filenames: false | ||
always_run: true | ||
args: | ||
- --branch=master | ||
- --branch=main | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v2.2.1 | ||
rev: v2.7.1 | ||
hooks: | ||
- id: prettier | ||
name: 🎨 Format using prettier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
[![GitHub Workflow Status][workflow-shield]][workflow] | ||
[![GitHub Release][releases-shield]][releases] | ||
[![GitHub Activity][commits-shield]][commits] | ||
![GitHub Workflow](https://img.shields.io/github/actions/workflow/status/DurgNomis-drol/mytoyota/build.yml) | ||
![Codecov](https://img.shields.io/codecov/c/github/DurgNomis-drol/mytoyota) | ||
![Commit activity](https://img.shields.io/github/commit-activity/y/DurgNomis-drol/mytoyota) | ||
![GitHub Release](https://img.shields.io/github/release/DurgNomis-drol/mytoyota.svg) | ||
![PyPI - Downloads](https://img.shields.io/pypi/dm/mytoyota) | ||
|
||
# Toyota Connected Services Europe Python module | ||
|
||
### [!] **This is still in beta** | ||
<b><p align=center> 🚨 Breaking changes ahead 🚨 </p></b> | ||
|
||
### [!] **Only EU is supported, other regions are not possible so far. See [this](https://github.com/widewing/toyota-na) for North America** | ||
<p align=center> Version 1.0.0 only supports the new ctpa-oneapi API endpoints that were introduced with the new MyToyota app. Some functions are not yet implemented and must first be determined due to the lack of API documentation. </p> | ||
<p align=center> Users of the old MyT app should use a mytoyota python module version < 1.0.0. </p> | ||
|
||
⚠️ _This is still in beta_ | ||
|
||
⚠️ _Only EU is supported, other regions are not possible so far. See [this](https://github.com/widewing/toyota-na) for North America_ | ||
|
||
## Description | ||
|
||
|
@@ -23,74 +30,21 @@ pip install mytoyota | |
|
||
## Usage | ||
|
||
```python | ||
import json | ||
import asyncio | ||
from mytoyota.client import MyT | ||
|
||
username = "[email protected]" | ||
password = "MyPassword" | ||
brand = "toyota" # or lexus | ||
|
||
# Get supported regions, can be passed to the optional 'region' argument of MyT | ||
# At this moment, only the 'europe' region is supported | ||
print(MyT.get_supported_regions()) | ||
|
||
client = MyT(username=username, password=password, brand=brand) | ||
|
||
async def get_information(): | ||
print("Logging in...") | ||
await client.login() | ||
|
||
print("Retrieving cars...") | ||
# Returns cars registered to your account + information about each car. | ||
cars = await client.get_vehicles() | ||
|
||
for car in cars: | ||
|
||
# Returns live data from car/last time you used it as an object. | ||
vehicle = await client.get_vehicle_status(car) | ||
|
||
# You can either get them all async (Recommended) or sync (Look further down). | ||
data = await asyncio.gather( | ||
*[ | ||
client.get_driving_statistics(vehicle.vin, interval="day"), | ||
client.get_driving_statistics(vehicle.vin, interval="isoweek"), | ||
client.get_driving_statistics(vehicle.vin), | ||
client.get_driving_statistics(vehicle.vin, interval="year"), | ||
] | ||
) | ||
|
||
# You can access odometer data like this: | ||
mileage = vehicle.dashboard.odometer | ||
# Or retrieve the energy level (electric or gasoline) | ||
fuel = vehicle.dashboard.fuel_level | ||
battery = vehicle.dashboard.battery_level | ||
# Or Parking information: | ||
latitude = vehicle.parkinglocation.latitude | ||
|
||
# Daily stats | ||
daily_stats = await client.get_driving_statistics(vehicle.vin, interval="day") | ||
|
||
# ISO 8601 week stats | ||
iso_weekly_stats = await client.get_driving_statistics(vehicle.vin, interval="isoweek") | ||
|
||
# Monthly stats is returned by default | ||
monthly_stats = await client.get_driving_statistics(vehicle.vin) | ||
|
||
# Get year to date stats. | ||
yearly_stats = await client.get_driving_statistics(vehicle.vin, interval="year") | ||
|
||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(get_information()) | ||
loop.close() | ||
For a quick start on how to use the package take a look at the `simple_client_example.py` file contained in the report. You can also use and execute this file directly by using the following commands: | ||
|
||
```bash | ||
python -m venv mytoyota | ||
source mytoyota/bin/activate | ||
python -m pip install "mytoyota @ git+https://github.com/DurgNomis-drol/mytoyota@master" | ||
curl -LO https://raw.githubusercontent.com/GitOldGrumpy/mytoyota/master/simple_client_example.py | ||
# Create a credentials.json file with {"username":"[email protected]","password":"yourpassword"} | ||
python simple_client_example.py | ||
``` | ||
|
||
## Known issues | ||
|
||
- Statistical endpoint will return `None` if no trip have been performed in the requested timeframe. This problem will often happen at the start of each week, month or year. Also daily stats will of course also be unavailable if no trip have been performed. | ||
- Currently, it is only possible to get various vehicle information. Functions for controlling and setting vehicle properties have not yet been implemented. | ||
|
||
## Docs | ||
|
||
|
@@ -100,7 +54,7 @@ Coming soon... | |
|
||
This python module uses poetry (>= 1.2.2) and pre-commit. | ||
|
||
To start contributing, fork this repository and run `poetry install`. Then create a new branch. Before making a PR, please run pre-commit `poetry run pre-commit run --all-files` and make sure that all tests passes locally first. | ||
To start contributing, fork this repository and run `poetry install`. Then create a new branch. Before making a PR, please run pre-commit `poetry run pre-commit run --all-files` and make sure that all tests passes locally first by running `pytest tests/`. | ||
|
||
## Note | ||
|
||
|
@@ -109,10 +63,3 @@ As I [@DurgNomis-drol](https://github.com/DurgNomis-drol) am not a professional | |
## Credits | ||
|
||
A huge thanks go to [@calmjm](https://github.com/calmjm) for making [tojota](https://github.com/calmjm/tojota). | ||
|
||
[releases-shield]: https://img.shields.io/github/release/DurgNomis-drol/mytoyota.svg?style=for-the-badge | ||
[releases]: https://github.com/DurgNomis-drol/mytoyota/releases | ||
[workflow-shield]: https://img.shields.io/github/actions/workflow/status/DurgNomis-drol/mytoyota/build.yml?branch=master&style=for-the-badge | ||
[workflow]: https://github.com/DurgNomis-drol/mytoyota/actions | ||
[commits-shield]: https://img.shields.io/github/commit-activity/y/DurgNomis-drol/mytoyota.svg?style=for-the-badge | ||
[commits]: https://github.com/DurgNomis-drol/mytoyota/commits/master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
"""Toyota Connected Services Client.""" | ||
from .client import MyT # pylint: disable=unused-import # NOQA | ||
from importlib_metadata import version | ||
|
||
try: | ||
import importlib.metadata as importlib_metadata | ||
except ModuleNotFoundError: | ||
# 3.7 | ||
import importlib_metadata | ||
from mytoyota.client import MyT # noqa | ||
|
||
__version__ = importlib_metadata.version(__name__) | ||
__version__ = version(__name__) |
Oops, something went wrong.