added the support of historique functionnality into the client

This commit is contained in:
0llino 2023-01-10 09:49:06 +01:00
parent 8f389b5137
commit 573ae6ef9a

View file

@ -20,15 +20,23 @@ def send_request(apiurl, headers, method="GET"):
req = requests.get(apiurl, headers=headers) req = requests.get(apiurl, headers=headers)
data = req.json() data = req.json()
for element in data: match apiurl.split('/')[-1]:
try: case "historique":
print("") for element in data:
print("TITRE : " + element['titre']) if element['query'] == '':
print("ID MIRABEL : " + str(element['mirabelid'])) print(f"id : {element['id']}, method : {element['method']}, section : {element['section']}")
print("URL : " + element['url']) else:
except TypeError: print(f"id : {element['id']}, method : {element['method']}, query : {element['query']}, section : {element['section']}")
continue case other:
for element in data:
try:
print("")
print("TITRE : " + element['titre'])
print("ID MIRABEL : " + str(element['mirabelid']))
print("URL : " + element['url'])
except TypeError:
continue
if __name__ == "__main__": if __name__ == "__main__":
""" Main function, printing helper & getting arguments """ """ Main function, printing helper & getting arguments """