-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfdp_bridge_api.py
87 lines (57 loc) · 2.11 KB
/
infdp_bridge_api.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import json
import requests
import logging
# This is the real deal
# API documentation https://bridge-infdp.teurukahika.govt.nz/api/v1/docs/
# This is unfinished and untested. No way of testing it yet.
BASE_URL = "https://bridge-infdp.teurukahika.govt.nz/api/v1/"
credentials = {"username": "",
"password": ""}
def authorize(key):
logging.critical("API is not up yet! Things will be incorrect!")
data = requests.post((BASE_URL + "login"), json = credentials)
logging.debug(f"API response: {data}")
if data:
return True
else:
return False
def get_fwfps() -> dict:
logging.critical("API is not up yet! Things will be incorrect!")
data = requests.get(BASE_URL + "fwfps")
logging.debug(f"API response: {data}")
return data
def get_fwfps_by_id(id) -> dict:
logging.critical("API is not up yet! Things will be incorrect!")
data = requests.get(BASE_URL + f"fwfps/{id}")
logging.debug(f"API response: {data}")
return data
def get_certification(id) -> dict:
logging.critical("API is not up yet! Things will be incorrect!")
data = requests.get(BASE_URL + f"certifications/{id}")
logging.debug(f"API response: {data}")
return data
def get_audit(id) -> dict:
logging.critical("API is not up yet! Things will be incorrect!")
data = requests.get(BASE_URL + f"audits/{id}")
logging.debug(f"API response: {data}")
return data
def get_document(id) -> dict:
logging.critical("API is not up yet! Things will be incorrect!")
data = requests.get(BASE_URL + f"documents/{id}")
logging.debug(f"API response: {data}")
return data
def get_land_uses() -> list:
logging.critical("API is not up yet! Things will be incorrect!")
data = requests.get(BASE_URL + "land-uses")
logging.debug(f"API response: {data}")
return data
def get_users() -> dict:
logging.critical("API is not up yet! Things will be incorrect!")
data = requests.get(BASE_URL + "users")
logging.debug(f"API response: {data}")
return data
def get_user(id) -> dict:
logging.critical("API is not up yet! Things will be incorrect!")
data = requests.get(BASE_URL + f"users/{id}")
logging.debug(f"API response: {data}")
return data