-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
15 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Toyota Connected Services Python module | ||
|
||
### [!] **This has not been published to PyPi yet** | ||
### [!] **This is still in beta** | ||
|
||
## Description | ||
|
||
|
@@ -17,82 +17,40 @@ pip install mytoyota | |
## Usage | ||
|
||
```python | ||
import aiohttp | ||
import asyncio | ||
from mytoyota.client import MyT | ||
|
||
username = "[email protected]" | ||
password = "MyPassword" | ||
locale = "da-dk" | ||
session = aiohttp.ClientSession() | ||
|
||
client = MyT(locale=locale, session=session) | ||
client = MyT(username=username, password=password, locale=locale, region="europe") | ||
|
||
print("Performing login...") | ||
client.perform_login(username=username, password=password) | ||
|
||
async def get_cars() | ||
print("Retrieving cars...") | ||
valid, cars = await client.get_cars() | ||
|
||
if valid: | ||
print(cars) | ||
return | ||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(get_cars()) | ||
loop.close() | ||
``` | ||
async def get_information(): | ||
print("Performing login...") | ||
print(await client.get_token()) | ||
print(client.get_uuid()) | ||
|
||
### Get odometer information | ||
|
||
```python | ||
async def get_odometer(vin) | ||
print("Retrieving odometer information...") | ||
odometer, odometer_unit, fuel = await client.get_odometer(vin=vin) | ||
print("Retrieving cars...") | ||
# Returns information about the cars registered to your account | ||
cars = await client.gather_information_json() | ||
|
||
print(odometer) | ||
print(odometer_unit) | ||
print(fuel) | ||
print(cars) | ||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(get_odometer(vin)) | ||
loop.run_until_complete(get_information()) | ||
loop.close() | ||
``` | ||
|
||
### Get parking information | ||
|
||
```python | ||
async def get_parking(vin) | ||
print("Retrieving latest parking information...") | ||
parking = await client.get_parking(vin=vin) | ||
|
||
print(parking) | ||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(get_parking(vin)) | ||
loop.close() | ||
``` | ||
|
||
### Get vehicle information | ||
## Docs | ||
|
||
```python | ||
async def get_vehicle_info(vin) | ||
print("Retrieving vehicle information...") | ||
battery, hvac, last_updated = await client.get_vehicle_information(vin=vin) | ||
|
||
print(battery) | ||
print(hvac) | ||
print(last_updated) | ||
|
||
loop = asyncio.get_event_loop() | ||
loop.run_until_complete(get_vehicle_info(vin)) | ||
loop.close() | ||
``` | ||
Coming soon... | ||
|
||
## Contributing | ||
|
||
This python uses poetry and pre-commit. | ||
This python module uses poetry 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. | ||
|
||
|
@@ -102,4 +60,4 @@ As I [@DurgNomis-drol](https://github.com/DurgNomis-drol) is not a professional | |
|
||
## Credits | ||
|
||
A huge thanks go to [@calmjm](https://github.com/calmjm) for making [tojota](https://github.com/calmjm/tojota). Which is used as the base for making this module. | ||
A huge thanks go to [@calmjm](https://github.com/calmjm) for making [tojota](https://github.com/calmjm/tojota). |