Skip to main content

Asynchronous Python client for the DVSPortal API as used by Dutch muncipalities for guest parking.

Project description

DVSPortal

Asynchronous Python client for the DVSPortal API. This library provides an easy-to-use async interface to interact with the DVSPortal API, allowing for operations such as fetching balances, creating reservations, and managing license plates.

Installation

To install DVSPortal, run the following command in your terminal:

pip install dvsportal

Ensure you are using Python 3.9 or newer, as this library utilizes modern Python features and type hinting.

Requirements

  • Python 3.9+
  • aiohttp
  • async_timeout
  • yarl

These dependencies will be automatically installed when you install the DVSPortal package.

Quick Start

Here's a quick example to get you started:

import asyncio
from dvsportal import DVSPortal

async def main():
    async with DVSPortal(api_host='api.example.com', identifier='your_identifier', password='your_password') as portal:
        await portal.update()
        print(f"Balance: {portal.balance}")
        print(f"Unit Price: {portal.unit_price}")
        print(f"Active Reservations: {portal.active_reservations}")

if __name__ == '__main__':
    asyncio.run(main())

Replace 'api.example.com', 'your_identifier', and 'your_password' with your actual DVSPortal API host and credentials.

Examples

Creating a Reservation

To create a reservation for a license plate:

import asyncio
from dvsportal import DVSPortal
from datetime import datetime, timedelta

async def create_reservation():
    async with DVSPortal(api_host='api.example.com', identifier='your_identifier', password='your_password') as portal:
        await portal.create_reservation(
            license_plate_value='ABC123',
            date_from=datetime.now(),
            date_until=datetime.now() + timedelta(days=1)
        )
        print("Reservation created successfully.")

if __name__ == '__main__':
    asyncio.run(create_reservation())

Managing License Plates

To add a new license plate:

import asyncio
from dvsportal import DVSPortal

async def add_license_plate():
    async with DVSPortal(api_host='api.example.com', identifier='your_identifier', password='your_password') as portal:
        await portal.store_license_plate(
            license_plate='ABC123',
            name='My Car'
        )
        print("License plate added successfully.")

if __name__ == '__main__':
    asyncio.run(add_license_plate())

Features

  • Asynchronous API communication
  • Fetching account balance and unit prices
  • Managing reservations
  • Handling license plates

How to Contribute

  1. Fork the repository on GitHub.
  2. Clone your forked repository to your local machine.
  3. Create a new branch for your feature or bug fix.
  4. Implement your changes.
  5. Run tests to ensure your changes don't break existing functionality.
  6. Commit your changes with a clear commit message.
  7. Push your changes to your fork on GitHub.
  8. Submit a pull request from your fork to the main DVSPortal repository.

Before contributing, please read the contribution guidelines in the CONTRIBUTING.md file.

License

DVSPortal is released under the MIT License. See the LICENSE file for more details.

Acknowledgements

This project is developed and maintained by [Your Name or Organization]. Contributions from the open-source community are welcome.

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

dvsportal-1.3.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

dvsportal-1.3.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file dvsportal-1.3.0.tar.gz.

File metadata

  • Download URL: dvsportal-1.3.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.6 Windows/10

File hashes

Hashes for dvsportal-1.3.0.tar.gz
Algorithm Hash digest
SHA256 519557f85a5df9e241955783c0b38511f3544b3ff293a69393bd53a1330e1d68
MD5 df72a713a0e93d2474c7bd3ba2877ac9
BLAKE2b-256 19fbca28119f36b4addf8713cbb9d7e87ac87978c8effdae9f8c44b1cdd5c707

See more details on using hashes here.

File details

Details for the file dvsportal-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: dvsportal-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.6 Windows/10

File hashes

Hashes for dvsportal-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92f42bb41af327617ef622d242b9f8b1296ed132f6a5616fd5040bffb0861db6
MD5 a243736530892aa516929464091c21e7
BLAKE2b-256 3953387946bc5d4a835645c6dd0507074996044db22bcc4b864d16df38a31e2e

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