pynissan
pynissan is an async Python client for MyNISSAN connected vehicles. It provides a typed
API for vehicle telemetry, charging, climate, remote commands, account data, and
connected-service features.
The client supports MyNISSAN accounts in the United States and Canada, plus MiNissan accounts in Mexico. Vehicle and subscription capabilities determine which telemetry and remote controls are available.
Highlights
- Fully async I/O built on
aiohttp. - Typed, immutable response models and a
py.typedmarker. - Cached vehicle, battery, charging, climate, door, location, tire, and mileage data.
- Charging, climate, lock, light, horn, engine, location, and status-refresh commands.
- Climate and charge schedules, vehicle capabilities, alerts, maintenance, and history.
- Automatic access-token refresh with a callback for persisting replacement tokens.
- Typed command requests with status polling and terminal results.
- Read-only mode enabled by default for safe discovery and monitoring.
Installation
python -m pip install pynissan
Python 3.12 or newer is required.
Supported account markets are Country.US, Country.CA, and Country.MX.
Quick start
The caller owns the aiohttp.ClientSession and decides how credentials and reusable tokens
are stored.
from aiohttp import ClientSession
from pynissan import Country, NissanClient, Tokens
async def save_tokens(tokens: Tokens) -> None:
"""Persist replacement tokens in the application's secure storage."""
async def read_vehicle(email: str, password: str) -> None:
async with ClientSession() as session:
client = NissanClient(
session,
country=Country.US,
token_listener=save_tokens,
)
await client.async_authenticate(email, password)
vehicles = await client.async_get_vehicles()
if not vehicles:
return
status = await client.async_get_vehicle_status(vehicles[0].vin)
if status.battery is not None:
print(status.battery.level)
print(status.battery.is_charging)
Supply previously saved tokens to avoid signing in again:
client = NissanClient(
session,
country=Country.US,
tokens=saved_tokens,
token_listener=save_tokens,
)
The client refreshes expired tokens before a request and publishes the replacement token set
through token_listener.
The authentication guide covers token reuse and request verification for applications that need those flows.
Read-only safety
NissanClient starts in read-only mode. Queries work normally, while methods that change
vehicle or account state raise ReadOnlyError before any network request is sent.
from pynissan import Country, NissanClient
client = NissanClient(
session,
country=Country.US,
tokens=saved_tokens,
read_only=False,
)
Enable write access only for an explicit user action. Remote commands return a typed request that can be polled until Nissan reports a terminal status.
from pynissan import ClimateSettings, TemperatureUnit
request = await client.async_start_climate(
vin,
ClimateSettings(72, TemperatureUnit.FAHRENHEIT),
)
result = await client.async_wait_for_service_request(vin, request)
Charging state
Battery status distinguishes the cable and charging states and includes the server-provided remaining charge time.
battery = await client.async_get_vehicle_battery_status(vin)
if battery is not None:
print(battery.level)
print(battery.is_plugged_in)
print(battery.is_charging)
print(battery.remaining_charge_time)
Errors
All package exceptions inherit from NissanError:
AuthenticationErrorfor sign-in and token-refresh failures;NetworkErrorfor connection and timeout failures;ApiErrorfor rejected HTTP requests;GraphQLErrorfor rejected GraphQL operations;ResponseErrorfor malformed responses;ReadOnlyErrorfor blocked state-changing operations.
Development
python -m pip install -e ".[test]"
python -m ruff check .
python -m ruff format --check .
python -m mypy
python -m pytest
python -m build
See the API guide and authentication guide for usage details. Development and release procedures are documented in CONTRIBUTING.md and docs/releasing.md. Security issues should follow SECURITY.md.
Project status
pynissan is maintained by the community and is not affiliated with, endorsed by, or
supported by Nissan Motor Co., Ltd.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 pynissan-0.2.0.tar.gz.
File metadata
- Download URL: pynissan-0.2.0.tar.gz
- Upload date:
- Size: 302.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4262bff8a04a8207019624dc2c8e8257ba37a4e62bd565f8d48a441d07760e97
|
|
| MD5 |
fdb5bcb4d0b4eaace84e79cc2ab9ea65
|
|
| BLAKE2b-256 |
8029880e8a6a83c315729409aa651791da6c66dcebb5d4c4eb1e4eaaaed27dbb
|
Provenance
The following attestation bundles were made for pynissan-0.2.0.tar.gz:
Publisher:
publish.yml on bvdcode/nissan-connect-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynissan-0.2.0.tar.gz -
Subject digest:
4262bff8a04a8207019624dc2c8e8257ba37a4e62bd565f8d48a441d07760e97 - Sigstore transparency entry: 2323174806
- Sigstore integration time:
-
Permalink:
bvdcode/nissan-connect-sdk@cc204625c44df8baa8f75be9c636b6ea549e5ccf -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bvdcode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cc204625c44df8baa8f75be9c636b6ea549e5ccf -
Trigger Event:
push
-
Statement type:
File details
Details for the file pynissan-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pynissan-0.2.0-py3-none-any.whl
- Upload date:
- Size: 257.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c0f300656c9282d854aa844cabfa09ddd7ba8abbe9900b43826d7dfaad2d31e
|
|
| MD5 |
78c366bf3c6dbd99495df8c6032d576c
|
|
| BLAKE2b-256 |
d2d4a125ac4bba8754059061be75f636bd1a95367a569e2b3c0af9aa527c246c
|
Provenance
The following attestation bundles were made for pynissan-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on bvdcode/nissan-connect-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynissan-0.2.0-py3-none-any.whl -
Subject digest:
4c0f300656c9282d854aa844cabfa09ddd7ba8abbe9900b43826d7dfaad2d31e - Sigstore transparency entry: 2323174852
- Sigstore integration time:
-
Permalink:
bvdcode/nissan-connect-sdk@cc204625c44df8baa8f75be9c636b6ea549e5ccf -
Branch / Tag:
refs/heads/main - Owner: https://github.com/bvdcode
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cc204625c44df8baa8f75be9c636b6ea549e5ccf -
Trigger Event:
push
-
Statement type: