Montrer les infos d'éligibilité dès qu'elles deviennent disponibles

This commit is contained in:
gaia 2023-04-01 03:51:09 +02:00 committed by Samuel Thibault
parent 2a3c1af043
commit 419f37d875

View file

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