diff --git a/src/client.py b/src/client.py index dded8aa..3eabfd6 100755 --- a/src/client.py +++ b/src/client.py @@ -20,15 +20,23 @@ def send_request(apiurl, headers, method="GET"): req = requests.get(apiurl, headers=headers) data = req.json() - - for element in data: - try: - print("") - print("TITRE : " + element['titre']) - print("ID MIRABEL : " + str(element['mirabelid'])) - print("URL : " + element['url']) - except TypeError: - continue + + match apiurl.split('/')[-1]: + case "historique": + for element in data: + if element['query'] == '': + print(f"id : {element['id']}, method : {element['method']}, section : {element['section']}") + else: + print(f"id : {element['id']}, method : {element['method']}, query : {element['query']}, section : {element['section']}") + 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__": """ Main function, printing helper & getting arguments """