Skip to main content

Python client for the Volvo Cars API.

Project description

Volvo Cars API

This python library lets you use the Volvo Cars API. Authorisation follows the OAuth 2.0 authorisation code flow with PKCE.

GitHub release Sponsor

Requirements

You'll need a Volvo Developers account and create an API application. Make sure to fill in all required fields and write down the retrieved client id and secret.

Usage

A script is worth a thousand words.

# Retrieved at the end of the API application registration process
client_id = "abc"
client_secret = "very-secret-key"

# Scopes that have been requested during the API application registration. You can also
# use less scopes than requested.
scopes = [
    "openid",
    "conve:battery_charge_level",
    "conve:brake_status",
    "conve:climatization_start_stop",
    "conve:command_accessibility",
    "conve:commands",
    "conve:diagnostics_engine_status",
    # ...
]

# Must be excactly as entered during the API application registration
redirect_uri = "htttps://my-volvo-application.io/callback" 

# The VCC API key retrieved after the API application registration process
api_key = "abcdef-1234567890-abcdef"

client_session = _get_client_session()

# Authenticate
auth = VolvoCarsAuth(
    client_session,
    client_id=client_id,
    client_secret=client_secret,
    scopes=scopes,
    redirect_uri=redirect_uri)
auth_uri = await auth.get_auth_uri() # optionally pass state

# Redirect user to auth_uri and wait for the callback
# ...

# Extract code from the callback url
code = _get_code_from_url()
await auth.async_request_token(code)

# The VIN must be linked to the account you sign in with
vin = "YV123456789012345"

# Create API client
api = VolvoCarsApi(client_session, auth, vin, api_key)

# Make API request
engine_warnings = await api.async_get_engine_warnings()

🥤 Powered by snacks

When I'm coding, I run on coffee, Coca-Cola*, and Lays* potato chips. If you'd like to show your appreciation for this project, consider making a small donation to help keep my stash stocked! (Note: I'm also happy to accept 1,000,000 USD — or EUR, I'm not picky. 😁)

ko-fi

* No affiliation with these brands — just personal favorites!

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

volvocarsapi-0.0.2b0.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

volvocarsapi-0.0.2b0-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file volvocarsapi-0.0.2b0.tar.gz.

File metadata

  • Download URL: volvocarsapi-0.0.2b0.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for volvocarsapi-0.0.2b0.tar.gz
Algorithm Hash digest
SHA256 372a2edd134b6cbf7fedf57792847dc26f1654c48acdc6e9e96549b476f6ac77
MD5 bf0cc30388f347f1c43dc12ccef851c2
BLAKE2b-256 cf04c5d9d70bf14d225eed2ff748199ca7db62703dfd77fc672b5f3abdbf86a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for volvocarsapi-0.0.2b0.tar.gz:

Publisher: publish.yml on thomasddn/volvo-cars-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file volvocarsapi-0.0.2b0-py3-none-any.whl.

File metadata

  • Download URL: volvocarsapi-0.0.2b0-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for volvocarsapi-0.0.2b0-py3-none-any.whl
Algorithm Hash digest
SHA256 dfdac35b6ca6b28729dcb701c18e1431b744b7ab07570e275e579e762d6d604a
MD5 52f4b96aefc16b7b8f6647bd3793ec02
BLAKE2b-256 f28010432c26e9c05e94d8219248e7f234829899b9b6647716d9267d2fb40302

See more details on using hashes here.

Provenance

The following attestation bundles were made for volvocarsapi-0.0.2b0-py3-none-any.whl:

Publisher: publish.yml on thomasddn/volvo-cars-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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