Python wrapper for the Austrian Parliament open data API
Project description
atparlpy
This project provides a Python wrapper for the Austrian Parliament's Open Data REST APIs. The API responses are available both as dataclasses and as Pandas Dataframes.
Installation
atparlpy is availalbe on PyPI and can be installed via pip:
$ pip install atparlpy
Usage
The atparlpy module exposes each dataset as a separate class. Import and instantiate the class for your desired dataset. For example for the Inquiries ("Parlamentarische Anfragen"):
>>> from atparlpy import Inquiries
>>> inquiries = Inquiries(gp=28, nrbr="NR").AsList()
>>> print(len(inquiries))
>>> print(inquiries[0].betreff)
To get the result as a dataframe instead, use the AsDataFrame() method:
>>> from atparlpy import Inquiries
>>> df = Inquiries(gp=28, nrbr="NR").AsDataFrame()
>>> print(df['status'].value_counts())
>>> df.to_csv('inquiries.csv', index=False)
All filters can also be set via the fluent API. For example:
>>> from atparlpy import Inquiries
>>> inquiries = Inquiries().gp(28).nrbr("NR").AsList()
See examples.py for more examples.
Convenience features
- Wherever the REST API only accepts the legislative period as a Roman numeral (
"GP_CODE": ["XXVIII"]), the wrapper also accepts the corresponding integer value. The Roman numeral can be set viagp_codeand the integer value viagp. If both are provided,gp_codetakes precedence. - The wrapper accepts either a list of strings or a single string value wherever the REST API only accepts a list of string values (e.g.,
"THEMEN": ["Arbeit"]can be set as.themen("Arbeit")or.themen(["Arbeit"])).
Supported datasets
Anträge (Motions)
# Beispiel: Abfrage nach allen Anträgen im Nationalrat während der XXVII. GP zum Thema Arbeit
motions = Motions(gp_code="XXVII").nrbr("NR").themen(["Arbeit"]).AsList()
Ausschussberichte (CommitteeReports)
# Beispiel: Abfrage nach allen parlamentarischen Anfragen im Bundesrat während der XXVIII. GP
inquiries = Inquiries(gp=28, nrbr="BR").AsList()
Beschlüsse (Resolutions)
# Beispiel: Abfrage nach allen Beschlüssen im Nationalrat während der 25. GP zum Thema Kultur
resolutions = Resolutions().nrbr("NR").gp_code("XXV").themen("Kultur").AsList()
Anfragen (Inquiries)
# Beispiel: Abfrage nach allen parlamentarischen Anfragen im Nationalrat während der XXVIII. GP zum Thema Arbeit oder Bildung
inquiries = Inquiries(gp=28, nrbr="NR").themen(["Arbeit", "Bildung"]).AsList()
Aktuelle Abgeordnete zum Nationalrat und Mitglieder des Bundesrats (Parliamentarians)
# Beispiel: Abfrage nach allen aktuellen Abgeordneten zum Nationalrat
members_of_parliament = Parliamentarians(nrbr="NR").AsList()
# Beispiel: Fraktionen im Nationalrat plus Anzahl der Abgeordneten
df = Parliamentarians(nrbr="NR").AsDataFrame()
print(df['sort_wp'].value_counts())
# Beispiel: Abfrage nach dem aktuellen Präsidenten des Nationalrats
president = Parliamentarians(nrbr="NR").funk("1PNR").AsList()[0]
# Beispiel: Abfrage nach allen aktuellen Mitgliedern des Bundesrats
members_of_the_national_council = Parliamentarians(nrbr="BR").AsList()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file atparlpy-0.1.0.tar.gz.
File metadata
- Download URL: atparlpy-0.1.0.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ba9260bcdda2b3e37a42c354c4bcaf46a9dc33792dba50e048371755a07728a
|
|
| MD5 |
e708b7ce0f278a4f634e9a24cc27f17c
|
|
| BLAKE2b-256 |
25e79d330be9d3b91a185ff807f0820180770286bd2a8fd07ed79b5429f9a53f
|
File details
Details for the file atparlpy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: atparlpy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ac8f233bea5231794a1889e9b36e6e47f14de8ead3ba35ee1e1729635e58aee
|
|
| MD5 |
492c948103dc4f6441cc4be07f2648fd
|
|
| BLAKE2b-256 |
e377e06e9fbbf1eac25b5257d1f2364fce11aec1bb14c0c829a1865edd6f18a3
|