特斯拉API客户端

tesla-client的Python项目详细描述


特斯拉客户

此库允许访问非官方的tesla api,以读取数据并向tesla车辆发出命令。

这个库的一个关键特性是它提供了一种简单的方法,可以将OAuth凭据与您选择的数据存储同步凭据在登录时或令牌刷新期间自动保存。

快速启动

import tesla_client

tesla_client.init(CLIENT_ID, CLIENT_SECRET)  # Get these values from https://pastebin.com/pS7Z6yyP

# Define an Account subclass of your own to manage OAuth credential storage
class MyTeslaAccount(tesla_client.Account):
    def get_credentials(self):
        return your_credentials_store.get()

    def save_credentials(self, creds):
        your_credentials_store.save(creds)


account = MyTeslaAccount()

# Log in (and automatically save the OAuth credentials)
account.login('mrsteven@gmail.com', 'password')

# Access a vehicle in this account
vehicle = account.get_vehicles()[0]

# Fetch some data from the vehicle
vehicle.data_request('drive_state')

# Send a command to the vehicle
vehicle.command('honk_horn')

特斯拉API没有得到特斯拉公司的官方支持。它可能随时停止工作有关api命令的详细文档,请参见https://tesla-api.timdorr.com/。感谢Tim Dorr在记录非官方API方面所做的工作

Tesla,Inc.不认可或支持此Python库。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Apache Flink外部Jar   创建和强制转换对象数组时发生java错误   Java,添加数组   具有相同包结构和类的java JAR   java Jenkins未能构建Maven项目   java为什么一个forloop比另一个更快,尽管它们做的“一样”?   servlets在将“/”站点迁移到Java EE包时处理contextpath引用   无法解析java MavReplugin:2.21或其某个依赖项   泛型如何编写比较器来泛化Java中的两种类型的对象?   java Android Emulator未在netbeans上加载   多线程Java使用线程对数组中的数字求和:在同步块中使用新变量作为锁:差异   java如何在JSP/servlet中设置<input>标记的值?