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.1.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.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dvsportal-1.3.1.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.1.tar.gz
Algorithm Hash digest
SHA256 ca2805d6e5f90b763b5a051bf7f668f8a1584fc31623d78045e2284b7fd5966e
MD5 0d65a2d457d681ed817d4f216210236d
BLAKE2b-256 ff9013bbc7e116f7c72efcbc605acf102e42501d9ac4c1254f5c655df3982696

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dvsportal-1.3.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c00c6965f5f0ac367cf91a38bda8ab91eb04b9987f1a5889d510736f77d6773d
MD5 a6b145c15ce2e57f8378287a8adef1b6
BLAKE2b-256 13e17422fb1c24647e749a331d56b886c07112ce2ef915037bccf85d0a5cf102

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