Skip to main content

Tesla Fleet API library for Python

Project description

tesla_fleet_api

Python library for Tesla Fleet API and Teslemetry.

Currently does not support the end to end encrypted telemetry or command API.

Based on Tesla Developer documentation.

TeslaFleetApi

This is the base class, however can also be used directly if you have a valid user access_token.

import asyncio
import aiohttp

from tesla_fleet_api import TeslaFleetApi, TeslaFleetError


async def main():
    async with aiohttp.ClientSession() as session:
        api = TeslaFleetApi(
            access_token="<access_token>",
            session=session,
            region="na",
            raise_for_status=True,
        )

        try:
            data = await api.vehicle.list()
            print(data)
        except TeslaFleetError.Base as e:
            print(e.message, e.error)

asyncio.run(main())

TeslaFleetOAuth

This extends TeslaFleetApi to support OAuth, and requires a client_id, and either a refresh_token or initial authentication code.

Teslemetry

This extends TeslaFleetApi to send requests through Teslemetry, which manages all aspects of Tesla OAuth. This class only requires an access_token from the Teslemetry console.

import asyncio
import aiohttp

from tesla_fleet_api import Teslemetry, TeslaFleetError


async def main():
    async with aiohttp.ClientSession() as session:
        api = Teslemetry(
            access_token="<access_token>",
            session=session,
            raise_for_status=True,
        )

        try:
            data = await api.vehicle.list()
            print(data)
        except TeslaFleetError.Base as e:
            print(e.message, e.error)

asyncio.run(main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tesla_fleet_api-0.0.4.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

tesla_fleet_api-0.0.4-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file tesla_fleet_api-0.0.4.tar.gz.

File metadata

  • Download URL: tesla_fleet_api-0.0.4.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for tesla_fleet_api-0.0.4.tar.gz
Algorithm Hash digest
SHA256 c181b53b16715f85c50450122f8897ebc105684e975374219b9aad099921fd50
MD5 91d0c297d215d45c6bc660cf493a25e9
BLAKE2b-256 9ecf6b00ab9e2298770d688caf3fa4285055f94d3bf08edf462a2a1093a37b33

See more details on using hashes here.

Provenance

File details

Details for the file tesla_fleet_api-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for tesla_fleet_api-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f7f5882013fa3c3564f68affbfd45f0523e41867079ae597f460aca412164f2b
MD5 2374955ce8d67670bfdfa096c49aff4f
BLAKE2b-256 ac67b92961651486965b4fd1ca671054afb19c91dd0f4d2415d3faf755f7cdca

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page