Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pyCityVisitorParking
Async Python library for Dutch municipal visitor parking providers

Provider-agnostic async Python library for Dutch municipal visitor parking systems.
Designed for Home Assistant, but usable in any async Python application.

PyPI version Python versions CI


About this library

pyCityVisitorParking is an async Python library for Dutch municipal visitor parking providers.

It exposes a small provider-agnostic API for:

  • provider discovery
  • permit lookup
  • reservation management
  • favorites management

The library is designed primarily for Home Assistant use, but it can also be used directly in any async Python application.


Status

Currently bundled providers:

  • DVS Portal
  • The Hague
  • 2park
  • Rotterdam

Provider manifests are discovered from src/pycityvisitorparking/provider/ without importing all providers up front.

Provider-specific documentation:


Supported municipalities

For the exact base_url, api_uri, and provider-specific notes, see the provider README files.

  • DVS Portal: Apeldoorn, Bloemendaal, Delft, Den Bosch, Doetinchem (via Buha), Groningen, Haarlem, Harlingen, Heemstede, Heerenveen, Heerlen, Hengelo, Katwijk, Leiden, Leidschendam-Voorburg, Middelburg, Nissewaard, Oldenzaal, Rijswijk, Roermond, Schouwen-Duiveland, Sittard-Geleen, Smallingerland, Sudwest-Fryslan, Veere, Venlo, Vlissingen, Waadhoeke, Waalwijk, Weert, Zaanstad, Zevenaar, Zutphen, Zwolle
  • The Hague: The Hague
  • 2park: Amstelveen, Assen, Bergen op Zoom, Breda, Deventer, Dordrecht, Eindhoven, Emmen, Etten-Leur, Gorinchem, Hardenberg, Harderwijk, Maastricht, Oosterhout, Oss, Roosendaal, Sluis, Terneuzen, Tiel, Veenendaal, Vlaardingen
  • Rotterdam: Rotterdam

Installation

Requires Python 3.14 or newer.

pip install pycityvisitorparking

Quickstart

import asyncio

from pycityvisitorparking import Client


async def main() -> None:
    async with Client(base_url="https://example", api_uri="/api") as client:
        provider = await client.get_provider("dvsportal")
        await provider.login(credentials={"username": "user", "password": "secret"})

        permit = await provider.get_permit()
        reservations = await provider.list_reservations()

        print(permit)
        print(reservations)


asyncio.run(main())

Public API

Client

Client is the main entry point.

  • list_providers() returns available ProviderInfo objects
  • get_provider(provider_id, ...) loads a specific provider on demand
  • Client accepts an optional injected aiohttp.ClientSession
  • if you do not inject a session, the client creates and owns its own session

Configuration options:

  • base_url: provider base URL
  • api_uri: optional provider API path
  • timeout: optional aiohttp.ClientTimeout
  • retry_count: retry count for idempotent GET requests

Data models

Public data models:

  • ProviderInfo
  • Permit
  • Zone
  • ZoneValidityBlock
  • Reservation
  • Favorite

Model highlights:

  • ProviderInfo includes id, favorite_update_fields, reservation_update_fields, balance_units, and zone_selection
  • Permit includes id, remaining_balance, balance_unit, zone_validity, and zones
  • Zone includes an opaque id, a display name, and its own zone_validity
  • ZoneValidityBlock contains UTC ISO 8601 start_time and end_time
  • Reservation includes id, name, license_plate, start_time, end_time, and zone_id (None when the provider has no zones)
  • Favorite includes id, name, and license_plate

Standardized behavior

  • timestamps are returned as UTC ISO 8601 strings
  • license plates are normalized and validated
  • the public API stays provider-agnostic
  • some update operations may be unsupported by a provider; inspect favorite_update_fields and reservation_update_fields

Zones

When ProviderInfo.zone_selection is true, Permit.zones lists the zones a reservation can be started in and start_reservation(..., zone_id=...) books in one of them. The first zone is the default: it is used when zone_id is omitted, and Permit.zone_validity holds its windows. Other providers leave Permit.zones empty and raise ValidationError when a zone_id is passed. Updating a reservation never changes its zone.


Common usage

List providers

import asyncio

from pycityvisitorparking import Client


async def main() -> None:
    async with Client() as client:
        for provider in await client.list_providers():
            print(provider.id, provider.reservation_update_fields)


asyncio.run(main())

Manage a reservation

import asyncio
from datetime import datetime, timedelta, timezone

from pycityvisitorparking import Client


async def main() -> None:
    async with Client(base_url="https://example", api_uri="/api") as client:
        provider = await client.get_provider("dvsportal")
        await provider.login(credentials={"username": "user", "password": "secret"})

        start_time = datetime(2024, 5, 1, 9, 0, tzinfo=timezone.utc)
        end_time = start_time + timedelta(hours=2)

        reservation = await provider.start_reservation(
            "12AB34",
            start_time=start_time,
            end_time=end_time,
            name="Visitor",
        )

        print(reservation.id)


asyncio.run(main())

Manage favorites

import asyncio

from pycityvisitorparking import Client
from pycityvisitorparking.exceptions import ProviderError


async def main() -> None:
    async with Client(base_url="https://example", api_uri="/api") as client:
        provider = await client.get_provider("dvsportal")
        await provider.login(credentials={"username": "user", "password": "secret"})

        favorite = await provider.add_favorite("12AB34", name="Visitor")

        try:
            updated = await provider.update_favorite(favorite.id, name="Visitor 2")
            print(updated)
        except ProviderError:
            print("Favorite updates are not supported by this provider")


asyncio.run(main())

Error handling

Public methods raise library exceptions instead of raw aiohttp exceptions:

  • AuthError
  • NetworkError
  • ValidationError
  • ProviderError
  • RateLimitError
  • ServiceUnavailableError
  • NotFoundError
  • TimeoutError
  • ConfigError

Each exception includes normalized metadata such as error_code, detail, and optional user_message.

Example:

from pycityvisitorparking import Client
from pycityvisitorparking.exceptions import AuthError, NetworkError, ProviderError, ValidationError

async with Client(base_url=base_url, api_uri=api_uri) as client:
    try:
        provider = await client.get_provider("dvsportal")
        await provider.login(credentials={"username": "user", "password": "secret"})
        permit = await provider.get_permit()
    except (AuthError, ValidationError) as exc:
        handle_auth_or_input_error(exc)
    except NetworkError as exc:
        handle_network_issue(exc)
    except ProviderError as exc:
        handle_provider_issue(exc)

Logging

The library logs to the pycityvisitorparking logger using the standard Python logging module.

  • credentials are not logged
  • full license plates are not logged
  • request context can be attached for clearer diagnostics

Development

This repository uses uv for local development tasks.

Common checks:

uv run --group lint ruff check .
uv run --group lint ruff format --check .
uv run --group typecheck pyright
uv run --group test pytest
uv run --group schema python -m pytest -o addopts=-q tests/test_manifest_schema.py
uv build
uvx twine check dist/*

Release notes and publishing are handled through GitHub Actions. See docs/RELEASING.md.


Provider development

Providers live under:

src/pycityvisitorparking/provider/<provider_id>/

A provider folder typically contains:

src/pycityvisitorparking/provider/<provider_id>/
  manifest.json
  __init__.py
  api.py
  const.py
  README.md
  CHANGELOG.md

Related documentation:


License

MIT. See LICENSE.

Metadata

Release files for pycityvisitorparking 0.6.0b2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pycityvisitorparking 0.6.0b2
File Size Uploaded Provenance Actions
pycityvisitorparking-0.6.0b2.tar.gz 107.9 kB With provenance Details for pycityvisitorparking-0.6.0b2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pycityvisitorparking 0.6.0b2
File Interpreter ABI Platform Actions
pycityvisitorparking-0.6.0b2-py3-none-any.whl Python 3 none any Details for pycityvisitorparking-0.6.0b2-py3-none-any.whl

Total release size: 213.3 kB

Release files / pycityvisitorparking-0.6.0b2.tar.gz

Download URL pycityvisitorparking-0.6.0b2.tar.gz
Size 107.9 kB
Tags Source
SHA-256 checksum
How to use checksums
406c44a74879c0bdfe565541fbc59efe3d5e105693a15edaf473088438ffebfc
BLAKE2b-256 checksum
How to use checksums
db9888687563eed9669721e491ce09e9d6c299d6fb50cd67a520c1978664d06b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Release files / pycityvisitorparking-0.6.0b2-py3-none-any.whl

Download URL pycityvisitorparking-0.6.0b2-py3-none-any.whl
Size 105.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5c898f0eebef5ad627110ab314692be546eaef8d10424e9f4fe540acf753d279
BLAKE2b-256 checksum
How to use checksums
6d0c52373c17bc2df4d96cc6e94e0823ace44a70fce5fbb529f7b9f80adf88ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

Security for pycityvisitorparking 0.6.0b2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pycityvisitorparking-0.6.0b2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page