johan/add-api #7

Merged
johan.le.baut merged 17 commits from johan/add-api into master 2023-02-28 22:32:35 +01:00
Showing only changes of commit 2f5dddde8b - Show all commits

View file

@ -4,6 +4,7 @@ import json
import time
import traceback
class Liazo:
def __init__(self):
pass
@ -13,7 +14,12 @@ class Liazo:
) -> dict:
nc = narrow_coordinates
c = httplib.HTTPSConnection("vador.fdn.fr")
api_params = "etape=gps_batiments&lat1=%f&lat2=%f&lon1=%f&lon2=%f" % (nc['swy'], nc['ney'], nc['swx'], nc['nex'])
api_params = "etape=gps_batiments&lat1=%f&lat2=%f&lon1=%f&lon2=%f" % (
nc["swy"],
nc["ney"],
nc["swx"],
nc["nex"],
)
req = f"/souscription/gps-batiments.cgi?{api_params}"
req = req.replace(" ", "%20")
r = None
@ -39,17 +45,18 @@ class Liazo:
ftthStatus="DEPLOYE", # Pas de status donc on dit que c'est ok mais on check avec l'arcep si axione KO cote front
reasonNotEligible=None,
)
idImm=building.get('ref')
idImm = building.get("ref")
if buildings.get(idImm):
buildings[idImm]["fdnEligStatus"] = fdnEligStatus
if buildings[idImm].get('found_in'):
buildings[idImm]['found_in'].append("liazo")
buildings[idImm]["etat_imm_priority"] = 4
if buildings[idImm].get("found_in"):
buildings[idImm]["found_in"].append("liazo")
else:
buildings[idImm]['found_in'] = ["liazo"]
buildings[idImm]["found_in"] = ["liazo"]
if not buildings.get(idImm):
building = Building(
y=building.get('lat'),
x=building.get('lon'),
y=building.get("lat"),
x=building.get("lon"),
idImm=idImm,
numVoieImm="",
typeVoieImm="",
@ -60,8 +67,12 @@ class Liazo:
found_in=["liazo"],
etat_imm_priority=4,
fdnEligStatus=fdnEligStatus,
aquilenetEligStatus=FAIEligibilityStatus(isEligible=False, reasonNotEligible="", ftthStatus=""),
othersEligStatus=FAIEligibilityStatus(isEligible=False, reasonNotEligible="", ftthStatus=""),
aquilenetEligStatus=FAIEligibilityStatus(
isEligible=False, reasonNotEligible="", ftthStatus=""
),
othersEligStatus=FAIEligibilityStatus(
isEligible=False, reasonNotEligible="", ftthStatus=""
),
)
buildings[idImm] = building