From fde1a65d6aff10452cf93e67525b2107cd8d6b01 Mon Sep 17 00:00:00 2001 From: Johan Le Baut Date: Sat, 12 Feb 2022 23:39:40 +0100 Subject: [PATCH] fix axione api: return result --- axione_api/api.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/axione_api/api.py b/axione_api/api.py index 061b5ac..dfae753 100644 --- a/axione_api/api.py +++ b/axione_api/api.py @@ -43,19 +43,17 @@ def fantoirRequest(insee, rivoli, numVoie): def query_axione_fantoir(cfg, insee, rivoli, numVoie): body = fantoirRequest(insee, rivoli, numVoie) - query_axione(cfg, body) + return query_axione(cfg, body) def query_axione_pto(cfg, ptoRef): body = ptoRequest(ptoRef) - query_axione(cfg, body) + return query_axione(cfg, body) def query_axione(cfg, body): # Note: the password should be the base64 of username:password. # Don't ask why. - passwd = base64.b64encode(f"{cfg.username}:{cfg.password}".encode("utf8")).decode( - "utf8" - ) + passwd = cfg.password headers = { "User-Agent": "aquilenet-elig-test/0.1", "Accept": "*/*", @@ -63,7 +61,7 @@ def query_axione(cfg, body): "Connection": "Keep-Alive", "Authorization": passwd, } - resp = None + respData = None if not cfg.debug: try: conn = http.client.HTTPSConnection( @@ -96,7 +94,7 @@ def query_axione(cfg, body): with open("./fixtures/dummy-data-1.xml", "r") as f: dummyData = f.read() return dummyData - return resp + return respData class LigneResult(TypedDict):