Python ORM and bindings for the Tweede Kamer Open Data Portaal OData API.
A pure Python interface for the Tweede Kamer API with type annotations for easy data model discovery.
Requires Python 3.5+.
Please create an issue if you have any problems, questions or suggestions.
pip install tkapi
See Open Kamer Data Model documentation for the data model that is mapped to Python classes.
A simple first example,
import tkapi
api = tkapi.TKApi()
personen = api.get_personen(max_items=100)
for persoon in personen:
print(persoon.achternaam)For more examples see the examples and tests.
See Tweede Kamer documentation for details.
| Algemeen | Persoon | Fractie | Commissie |
|---|---|---|---|
| Activiteit | Persoon | Fractie | Commissie |
| ActiviteitActor | PersoonContactinformatie | FractieZetel | CommissieContactinformatie |
| Agendapunt | PersoonFunctie | FractieZetelPersoon | CommissieZetel |
| Besluit | PersoonGeschenk | FractieZetelVacature | CommissieZetelVastPersoon |
| Document | PersoonLoopbaan | FractieZetelVacature | CommissieZetelVastVacature |
| DocumentActor | PersoonNevenfunctie | CommissieZetelVervangerPersoon | |
| DocumentVersie | PersoonNevenfunctieInkomsten | CommissieZetelVervangerVacature | |
| Kamerstukdossier | PersoonOnderwijs | ||
| Reservering | PersoonReis | ||
| Stemming | |||
| Vergadering | |||
| Verslag | |||
| Zaak | |||
| ZaakActor | |||
| Zaal |
Run all tests,
pytestRun all tests,
coverage run -m unittest discoverCreate coverage report,
coverage htmlThen visit htmlcov/index.html in your browser.
This project uses Python packaging with pyproject.toml. To publish a new version to PyPI:
-
Install build tools (if not already installed):
pip install build twine
-
Update the version in
pyproject.toml:version = "X.Y.Z"
-
Build the package:
python -m build
This will create distribution files in the
dist/directory. -
Test the build locally (optional but recommended):
pip install dist/tkapi-X.Y.Z-py3-none-any.whl
-
Upload to Test PyPI (optional, for testing):
twine upload --repository-url https://test.pypi.org/legacy/ dist/* -
Upload to PyPI:
twine upload dist/*You'll need PyPI credentials (username and password/token). You can create an API token at https://pypi.org/manage/account/token/