Metadata-Version: 2.2
Name: volvo-connected
Version: 0.2.0
Summary: A Python package for interacting with Volvo Connect API.
Author-email: Stephan van Rooij <github@svrooij.io>
License: The MIT License (MIT)
        
        Copyright (c) 2025 Stephan van Rooij
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/svrooij/py_volvo_connected/
Project-URL: Documentation, https://github.com/svrooij/py_volvo_connected/
Project-URL: Source, https://github.com/svrooij/py_volvo_connected/
Project-URL: Tracker, https://github.com/svrooij/py_volvo_connected/issues
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: AUTHORS.rst
Requires-Dist: microsoft-kiota-http>=1.9.1
Requires-Dist: microsoft-kiota-serialization-json>=1.9.1
Provides-Extra: dev
Requires-Dist: black; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: pytest-mock; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: requests-mock; extra == "dev"
Requires-Dist: requests; extra == "dev"
Requires-Dist: setuptools; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: wheel; extra == "dev"

# Volvo Connected Vehicle API

This is an unofficial Python client for the [Volvo Connected Vehicle API](https://developer.volvocars.com/apis/connected-vehicle/v2/overview/). It is based on the [official API documentation](https://developer.volvocars.com/apis/connected-vehicle/v2/specification/).

Source: [svrooij/py_volvo_connected](https://github.com/svrooij/py_volvo_connected)

## Installation

```bash
pip install volvo-connected
```

## Usage

```python
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

```python
vehicles = await client.vehicles.get()
```

### Get vehicle by VIN

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

### Get Fuel or Battery level

```python
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.
