This package provides mostly autogenerated pydantic-based model classes for the Verzeichnisdienst API.
It does not provide you with an HTTP client.
Install it from PyPI
pip install verzeichnisdienst
Then use it:
from verzeichnisdienst.v1.models import ApiRecord
my_json = {
"providerId": "1234567890123",
"apiId": "example",
"majorVersion": 1,
"url": "https://www.example.org/api/resource/v1",
"additionalMetadata": None,
"lastUpdated": "2024-10-01T00:00:00+00:00",
"revision": 1,
"status": "Test",
}
my_strongly_typed_record = ApiRecord.model_validate(my_json)
or
from verzeichnisdienst.v1.websocket import Contact
my_json_contact = {
"email": "verzeichnis@hochfrequenz.de",
"phone": "0049123457890"
}
my_strongly_typed_contact = Contact.model_validate(my_json_contact)
See the tests for more examples.
This project is based on datamodel-code-generator
.
Most of the classes are autogenerated from the openapi.yml
which can be found on SwaggerHub.
After updating the openapi.yml
file, use
tox -e codegen
to re-generate the model classes.
You are very welcome to contribute to this template repository by opening a pull request against the main branch.