This package provides mostly autogenerated pydantic-based model classes for the MaLo ident API.
We also maintain a C#/.NET Version of this data model.
It does not provide you with an HTTP client.
Install it from PyPI
pip install maloidentThen use it:
from maloident.v1.models import ResultNegative
my_json = {
"decisionTree": "E_0594",
"responseCode": "A10",
"reason": "Ich bin ein Freitext.",
"networkOperator": 9900987654321,
}
result = ResultNegative.model_validate(my_json)The request payload type for the Lieferant➡️Netzbetreiber identification request is maloident.models.IdentificationParameter.
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.
Note that we fixed some errors in the official OpenAPI spec.
Our changes are mentioned at the beginning of the openapi.yml file.
malo-ident-python-models/openapi/openapi.yml
Lines 4 to 10 in 3cfe0ae
After updating the openapi.yml file, use (this requires Python >=3.10, since datamodel-code-generator dropped support for Python 3.9)
uv sync --group codegen
uv run datamodel-codegen --encoding utf-8 --input openapi/v1/openapi.yml --output src/maloident/v1/_autogenerated.py --input-file-type openapi --output-model-type pydantic_v2.BaseModel --output-datetime-class AwareDatetime
uv run ruff check --select I --fix src/maloident/v1/_autogenerated.py
uv run ruff format src/maloident/v1/_autogenerated.pyto re-generate the model classes.
You are very welcome to contribute to this template repository by opening a pull request against the main branch.