Communicate with Tesla's official API
Project description
MODELpY
An unofficial Python library for Tesla's official Fleet API.
Supported Functionality
- Authentication
- Fleet Configuration
- Vehicle Endpoints
- Vehicle Commands
- Charging Endpoints
- Energy Endpoints
- User Endpoints
- Partner Endpoints
Features
- Automatically refreshes your token to avoid your code failing after an extended period of time
- All that is needed to start interacting with your Tesla products is a client ID and a refresh token
- JSON responses are return as Models complete with typing
- Full JSON data is also accessible so new API functionality may be immediately supported
Usage
- Get a hold of your client ID and refresh token
- This is done by Creating an Application
- I won't include setup instructions here, but TeslaMate makes it fairly painless
- Import the TeslaService (and any other service you'll be using) from
modelpyfrom modelpy import TeslaService from modelpy.vehicle import VehicleService
- Instantiate the TeslaService for your client ID
tesla = TeslaService("abcd1234-5678-9abc-defg-hijklmnopqrst")
- Create your other services using the TeslaService
vehicle_service = VehicleService(tesla)
- Now you are ready to interact with the API endpoints
from modelpy import TeslaService from modelpy.vehicle import VehicleService tesla = TeslaService("abcd1234-5678-9abc-defg-hijklmnopqrst") vehicle_service = VehicleService(tesla) print(vehicle_service.vehicle())
TODO
- Paginated results are not yet supported
- The North American servers are hardcoded in at the moment
- Encrypt stored token
- Use access tokens more and refresh tokens less
Caveats
- The vehicle subscription endpoints are not supported and will remain that way unless I discover additional documentation
- Your refresh token is stored in plaintext so anyone with access to your device could have full access to your account
- Many scenarios will remain untested as I cannot simulate Tesla's responses with my limited products
- Tesla's docs are sometimes inconsistent or seemingly mistyped, again I can only confirm that I have programmed to align with said documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
modelpy-0.1.0b0.tar.gz
(11.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file modelpy-0.1.0b0.tar.gz.
File metadata
- Download URL: modelpy-0.1.0b0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.22.2 CPython/3.12.8 Linux/6.8.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1434b9c5be2caa215181a6bd4d0a0001b476cbc047cc980755ecdd61e6d0a859
|
|
| MD5 |
308b2b0a86a5e84e6604981d866a14e6
|
|
| BLAKE2b-256 |
dce985abba1f18e3d67defca4d71dbf96786c0c76e2e83fa69706131c9f13607
|
File details
Details for the file modelpy-0.1.0b0-py2.py3-none-any.whl.
File metadata
- Download URL: modelpy-0.1.0b0-py2.py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.22.2 CPython/3.12.8 Linux/6.8.0-1017-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f2578c6cea99940a3adf9cf35d7a16cebd632cbf37c9ef225d366cfb9e7f846
|
|
| MD5 |
0dd83381dddf1160fb51f44ad8bbe451
|
|
| BLAKE2b-256 |
ab71871c00276cd536eac8edc12077a7b67bcfb4749f9080e69a7521d353dc0b
|