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.2.tar.gz (5.9 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.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dvsportal-1.3.2.tar.gz
  • Upload date:
  • Size: 5.9 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.2.tar.gz
Algorithm Hash digest
SHA256 c7b63bf938250f655abb84c3e1d3679699cedbb7a2c645baa47f065f1001eb7e
MD5 b0bfc2cad3f600368e2f49ab1aeab962
BLAKE2b-256 c4c8f9afdb1298313fef8a9d9f97aac0e3d7b828fc6460d085549dc716d49418

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dvsportal-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 6.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e28cbcdb77bea57a64835cbd78abbb5898d941890cff284043aa76cf11b6ce61
MD5 7599ef297c5fafb5adc5ba2294b20bdf
BLAKE2b-256 6c9ef3121cef4be63a77aa796d9cc6fa7478593390e9cb1af41fc23e8c23c902

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