An open API service indexing awesome lists of open source software.

https://github.com/hochfrequenz/verzeichnisdienst-python-models

Pydantic Model Classes for the EDI@Energy Verzeichnisdienst API
https://github.com/hochfrequenz/verzeichnisdienst-python-models

api bdew codegen edi-energy energiewirtschaft verzeichnisdienst

Last synced: 6 months ago
JSON representation

Pydantic Model Classes for the EDI@Energy Verzeichnisdienst API

Awesome Lists containing this project

README

          

# Verzeichnisdienst Python Models

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
![Python Versions (officially) supported](https://img.shields.io/pypi/pyversions/verzeichnisdienst.svg)
![Pypi status badge](https://img.shields.io/pypi/v/verzeichnisdienst)
![Unittests status badge](https://github.com/Hochfrequenz/malo-ident-python-models/workflows/Unittests/badge.svg)
![Coverage status badge](https://github.com/Hochfrequenz/malo-ident-python-models/workflows/Coverage/badge.svg)
![Linting status badge](https://github.com/Hochfrequenz/malo-ident-python-models/workflows/Linting/badge.svg)
![Black status badge](https://github.com/Hochfrequenz/malo-ident-python-models/workflows/Formatting/badge.svg)

This package provides mostly autogenerated [pydantic](https://docs.pydantic.dev/latest/)-based model classes for the Verzeichnisdienst API.

It does not provide you with an HTTP client.

## Installation

Install it from [PyPI](https://pypi.org/project/verzeichnisdienst)

```bash
pip install verzeichnisdienst
```

Then use it:

```python
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

```python
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](unittests/test_models.py) for more examples.

## Project Structure

This project is based on [`datamodel-code-generator`](https://github.com/koxudaxi/datamodel-code-generator/).
Most of the classes are autogenerated from the [`openapi.yml`](openapi/v1/openapi.yml) which can be found on [SwaggerHub](https://app.swaggerhub.com/apis-docs/edi_energy/Verzeichnisdienst_Web-API_2024_10_01/1.0.0).

After updating the `openapi.yml` file, use

```bash
tox -e codegen
```

to re-generate the model classes.

## Contribute

You are very welcome to contribute to this template repository by opening a pull request against the main branch.