丰田北美服务API的Python客户端
项目描述
丰田北美
丰田北美服务API的Python客户端
安装
pip install toyota-na
用法
python -m toyota_na.app -h # Get help
python -m toyota_na.app authorize <username> <passworde>
python -m toyota_na.app get_user_vehicle_list # List vehicle
python -m toyota_na.app get_vehicle_status <vin> # Get vehcicle status
...
已知问题
- 除非首先调用
send_refresh_status
并等待其完成(没有成功完成的提示),否则门/窗状态可能不会始终是最新的。
开发者指南
快速入门
from toyota_na.client import ToyotaOneClient
async def main():
cli = ToyotaOneClient()
await cli.auth.login(USERNAME, PASSWORD)
vehicle_list = await cli.get_user_vehicle_list()
vehicle_status = await cli.get_vehicle_status(vehicle_list[0]["vin"])
...
抽象接口示例
from toyota_na.client import ToyotaOneClient
from toyota_na.vehicle.vehicle import get_vehicles
async def main():
cli = ToyotaOneClient()
贡献
我们使用black和isort进行有意见的格式化,以确保代码库的一致外观和感觉,无论贡献者是谁。Pre-commit用于确保被检查到repo的文件格式正确。
为了方便,还包含了一个vscode项目设置文件。如果希望在编辑时进行格式化,其他编辑器将需要一些设置。
开始使用
- 安装poetry - https://python-poetry.cn/docs/#osx--linux--bashonwindows-install-instructions
- 克隆repo
poetry install
poetry shell
pre-commit install
示例
API调用示例的响应存储在samples
文件夹中。数据来自真实用户和丰田应用中的“演示模式”。
致谢
感谢 @DurgNomis-drol 制作原始的Toyota模块,并引发了关于丰田北美的讨论。
感谢 @visualage 找到无头认证的方法。
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。
源代码发行版
toyota-na-2.1.1.tar.gz (13.3 kB 查看哈希值)
构建发行版
toyota_na-2.1.1-py3-none-any.whl (17.9 kB 查看哈希值)