tkapi
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.
Installation
pip install tkapi
Data model
See Open Kamer Data Model documentation for the data model that is mapped to Python classes.
Usage
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.
Entities
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 |
Development
Tests
Run all tests,
pytest
Coverage report
Run all tests,
coverage run -m unittest discover
Create coverage report,
coverage html
Then visit htmlcov/index.html in your browser.
Publishing
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/
Metadata
Release files for tkapi 0.9.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tkapi-0.9.10.tar.gz | 37.2 kB | Without provenance | Details for tkapi-0.9.10.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tkapi-0.9.10-py3-none-any.whl | Python 3 | none | any | Details for tkapi-0.9.10-py3-none-any.whl |
Total release size: 65.9 kB
Release files / tkapi-0.9.10.tar.gz
| Download URL | tkapi-0.9.10.tar.gz |
|---|---|
| Size | 37.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a1bf229e9baa16bd29bc6c41c03017ed1b7a88b165de6988a9a75b6bc7e4e41
|
|
BLAKE2b-256 checksum How to use checksums |
5b4228c947141b642370632a6db833213e716bc81ecd9af68e3641d45fe8cefb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / tkapi-0.9.10-py3-none-any.whl
| Download URL | tkapi-0.9.10-py3-none-any.whl |
|---|---|
| Size | 28.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
913a2408d9c065cab1314a5ede9201b111702a8d5eda7cfbb6f5eec666062f7b
|
|
BLAKE2b-256 checksum How to use checksums |
42ee7411b956d0b163a6edaaefc3c798f54bdc75ce8c063f9172fe38c4b38ddc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for tkapi 0.9.10
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.