Add netwo API #8

Merged
johan.le.baut merged 13 commits from netwo into master 2024-05-07 20:01:27 +02:00
Showing only changes of commit 1764b5ce52 - Show all commits

View file

@ -160,6 +160,7 @@ class Netwo:
"imb_ref": imb_info.get("imb_id"), "imb_ref": imb_info.get("imb_id"),
"pm_ref": imb_info.get("pm_id"), "pm_ref": imb_info.get("pm_id"),
} }
netwo_elig["imb_info"] = imb_info
response = requests.post( response = requests.post(
"https://api.netwo.io/api/v1/eligibility", "https://api.netwo.io/api/v1/eligibility",
headers=self.netwo_api_headers, headers=self.netwo_api_headers,
@ -204,6 +205,9 @@ class Netwo:
+ netwo_elig["nbOperatorsErrors"] + netwo_elig["nbOperatorsErrors"]
+ netwo_elig["nbOperatorsPending"] + netwo_elig["nbOperatorsPending"]
) )
netwo_elig["eligOffers"] = self.get_netwo_eligibility_results(
id_elig, search_ftto
)
if timeout and time.time() > timeout: if timeout and time.time() > timeout:
netwo_elig["timeoutReached"] = True netwo_elig["timeoutReached"] = True
yield json.dumps(netwo_elig, indent=2) yield json.dumps(netwo_elig, indent=2)
@ -222,7 +226,6 @@ class Netwo:
id_elig, search_ftto id_elig, search_ftto
) )
netwo_elig["eligDone"] = True netwo_elig["eligDone"] = True
netwo_elig["imb_info"] = imb_info
yield json.dumps(netwo_elig, indent=2) yield json.dumps(netwo_elig, indent=2)
return Response(event_stream(), mimetype="text/event-stream") return Response(event_stream(), mimetype="text/event-stream")