-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplenarsitzungen.py
41 lines (28 loc) · 1.14 KB
/
plenarsitzungen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import requests
import json
url = "https://www.parlament.gv.at/Filter/api/json/post?jsMode=EVAL&FBEZ=WFP_007&listeId=11070&showAll=true"
headers = {"Content-Type": "application/json", "Accept": "application/json"}
def handle_response(response):
if response.status_code == 200:
return response.json()
return None
def get_sitzungen(gp: str):
payload = {"MODUS": ["PLENAR"], "NRBRBV": ["NR"], "GP": [gp]}
response = requests.post(url, headers=headers, data=json.dumps(payload))
return handle_response(response)
def get_gegenstand_info(gegenstand_path: str):
gegenstand_url = f"https://www.parlament.gv.at{gegenstand_path}?json=True"
response = requests.get(gegenstand_url)
return handle_response(response)
# GP: Gesetzgebungsperiode
#gps = ["XX", "XXI", "XXII", "XXIII", "XXIV", "XXV", "XXVI", "XXVII"]
gps = ["XXVII"]
for gp in gps:
data = get_sitzungen(gp)
# gegenstaende = data["rows"]
for gegenstand in data["rows"]:
gegenstand_path = gegenstand[8]
gegenstand_info = get_gegenstand_info(gegenstand_path)
if not gegenstand_info:
continue
# ...