Skip to main content

A Python package for interacting with Volvo Connect API.

Project description

Volvo Connected Vehicle API

This is an unofficial Python client for the Volvo Connected Vehicle API. It is based on the official API documentation.

Source: svrooij/py_volvo_connected

Installation

pip install volvo-connected

Usage

from kiota_http.httpx_request_adapter import HttpxRequestAdapter
from volvo_connected import (
  StaticAccessTokenProvider,
  # DynamicAccessTokenProvider,
  VolvoAuthenticationProvider,
  VolvoConnectedClient
)

# Create an access token provider using a static access token
access_token_provider = StaticAccessTokenProvider("YOUR_ACCESS_TOKEN")

# Or explore the DynamicAccessTokenProvider that allows you to auto refresh the token

# def access_token_function(url: str) -> str:
#   # Implement your logic to get the access token using the URL
#   return "your_dynamic_access_token"
# access_token_provider = DynamicAccessTokenProvider(access_token_function)

# Create an authentication provider using your VCC API key and the access token provider
auth_provider = VolvoAuthenticationProvider("YOUR_VCC_API_KEY", access_token_provider)

# Create a client with a request adapter that has the authentication provider
client = VolvoConnectedClient(HttpxRequestAdapter(auth_provider))

Get all vehicles

vehicles = await client.vehicles.get()

Get vehicle by VIN

vehicle = await client.vehicles.by_vin("YV4952NA4F120DEMO").get()

Get Fuel or Battery level

fuel_resp = await client.vehicles.by_vin("YV4952NA4F120DEMO").fuel.get()

fuel_resp.data.fuel_amount.value
# or
fuel_resp.data.battery_charge_level.value

All other endpoints

This client is genereted based on the (adjusted) OpenAPI specification. And everything is strong typed, so go ahead and explore the API.

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

volvo_connected-0.2.0.tar.gz (55.7 kB view details)

Uploaded Source

Built Distribution

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

volvo_connected-0.2.0-py3-none-any.whl (97.4 kB view details)

Uploaded Python 3

File details

Details for the file volvo_connected-0.2.0.tar.gz.

File metadata

  • Download URL: volvo_connected-0.2.0.tar.gz
  • Upload date:
  • Size: 55.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for volvo_connected-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7251672e2572856728adcdbc07bc74d5f9976b8bbee900453c3576680de9d23b
MD5 00e23f7d079bd591e925a9fae95686c8
BLAKE2b-256 6fe0e06054cceb577836b4e4604d928b8bf87836de1b90ff2fb0c488ced22a9f

See more details on using hashes here.

File details

Details for the file volvo_connected-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for volvo_connected-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7af960032bbe33ec53230f634754f98aa8044a04a3e24eec5cb16741d5c7609e
MD5 c36eac67c68139e39ce9d1b5950ed62c
BLAKE2b-256 0b41245b8388aa9827923c775e5bd7453a0ef373fb95075c5326e4e0527a8237

See more details on using hashes here.

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