New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

teslemetry-stream

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

teslemetry-stream

Teslemetry Streaming API library for Python

  • 0.6.12
  • PyPI
  • Socket score

Maintainers
1

Teslemetry Stream Library

This is an asynchronous Python 3 library that connects to the Teslemetry Stream server and provides Tesla Fleet Telemetry using server side events.

Installation

pip install teslemetry-stream

Usage

The TeslemetryStream class requires:

  • session: an aiohttp.ClientSession
  • access_token: an access token from the Teslemetry console
  • vin: If you only want to use a single vehicle, otherwise use create_vehicle
  • server: The Teslemetry server to connect to, otherwise use find_server
    • na.teslemetry.com
    • eu.teslemetry.com

The full list of possible values are provided in TelemetryFields and TelemetryAlerts

To connect, either use async with on the instance, call connect(), or register an callback with async_add_listener, which will connect when added and disconnect when removed.

Using connect() or listen() will require you to close the session manually using close().

Example

The following example puts the listening loop in the background, then stopping after 20 seconds.

async def main():
    async with aiohttp.ClientSession() as session:
        stream = TeslemetryStream(
            access_token="<token>",
            vin="<vin>", # for single vehicles
            server="na.teslemetry.com" # or "eu.teslemetry.com"
            session=session,
        )
        await stream.connect()

        def callback(event):
            print(event["data"])

        remove = stream.async_add_listener(callback)

        print("Running")
        await asyncio.sleep(60)
        remove()

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc