Skip to main content

Python Wrapper for the Bundestags API

Project description

BundestagsAPy: A python wrapper for the Bundestags DIP API.

Installation

The easiest way to install the latest stable version from PyPI is by using pip:

pip install bundestagsapy

Alternatively, install directly from the GitHub repository:

pip install git+https://github.com/parobo/BundestagsAPy

Usage

To use the API wrapper, simply call the client object with your API key. See https://dip.bundestag.de/%C3%BCber-dip/hilfe/api#content on how to get an API key.

Initialization

import BundestagsAPy
api_key='XXXXXXXXXXXXXXX'
client = BundestagsAPy.Client(api_key)

Endpoints

The client provides access to all available documents through methods named after the endpoints (bt_{endpoint}). E.g.

client.bt_aktivitaet(max_results=50,id,start_date,end_date,drucksache,plenaeprotokoll,zuordnung)

The available endpoint are:

  • aktivitaet: bt_aktivitaet()
  • drucksache: bt_drucksache()
  • drucksache-text: bt_drucksache_text()
  • person: bt_person()
  • plenarprotokoll: bt_plenarprotokoll()
  • plenarprotokoll-text: bt_plenarprotokoll_text
  • vorgang: bt_vorgang
  • vorgangsposition: bt_vorgangsposition

All methods accept max_results as input. It takes either an interger as value, in which case the method returns the first max_results supplied by the API, or False, in which case all available documents are returned.

id can either be an integer (for single document returned) or a list (for multiple).

see https://dip.bundestag.de/documents/informationsblatt_zur_dip_api_v01.pdf for details on other acceptable parameters for each endpoint.

Results

The results from each request to an endpoint is an object named after the document requested if a single document was requested. Each object has as its attributes all the available data named in the same way as documented on https://dip.bundestag.de/documents/informationsblatt_zur_dip_api_v01.pdf.

If multiple documents were requested, BundestagsAPy returns a list of the documents. E.g.

for result in client.bt_aktivitaet(max_results=False, start_date='2020-01-01',end_date='2020-01-02'):
	print(result.id,result.titel)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

BundestagsAPy-1.0a0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

BundestagsAPy-1.0a0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file BundestagsAPy-1.0a0.tar.gz.

File metadata

  • Download URL: BundestagsAPy-1.0a0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.6

File hashes

Hashes for BundestagsAPy-1.0a0.tar.gz
Algorithm Hash digest
SHA256 8d8d90c298c9be743923113319e8e0b7a505aa7f9f66665587f0af1625c7a5b6
MD5 568e0360b6663fbddc951f37960995a3
BLAKE2b-256 55692b229b72118fcdf2b215699e6c6c6ce1ac082a852aeed0bbc9a820b63739

See more details on using hashes here.

File details

Details for the file BundestagsAPy-1.0a0-py3-none-any.whl.

File metadata

  • Download URL: BundestagsAPy-1.0a0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.6

File hashes

Hashes for BundestagsAPy-1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 4fad280e31e3d375bdada731f4812b01df7a902db973ef47b0c92347befaa4b5
MD5 c026af0e122000175898cac231b51d5a
BLAKE2b-256 3adcd6f4043cc43537b7a5e04a67f7f43546616b77abcf2c1c3a150ea62171bb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page