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,16 +4,22 @@ import json
import time import time
import traceback import traceback
class Liazo: class Liazo:
def __init__(self): def __init__(self):
pass pass
def getAreaBuildings( def getAreaBuildings(
self, narrow_coordinates: AreaCoordinates(), existing_buildings: dict self, narrow_coordinates: AreaCoordinates(), existing_buildings: dict
) -> dict: ) -> dict:
nc=narrow_coordinates nc = narrow_coordinates
c = httplib.HTTPSConnection("vador.fdn.fr") 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 = f"/souscription/gps-batiments.cgi?{api_params}"
req = req.replace(" ", "%20") req = req.replace(" ", "%20")
r = None 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 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, reasonNotEligible=None,
) )
idImm=building.get('ref') idImm = building.get("ref")
if buildings.get(idImm): if buildings.get(idImm):
buildings[idImm]["fdnEligStatus"] = fdnEligStatus buildings[idImm]["fdnEligStatus"] = fdnEligStatus
if buildings[idImm].get('found_in'): buildings[idImm]["etat_imm_priority"] = 4
buildings[idImm]['found_in'].append("liazo") if buildings[idImm].get("found_in"):
buildings[idImm]["found_in"].append("liazo")
else: else:
buildings[idImm]['found_in'] = ["liazo"] buildings[idImm]["found_in"] = ["liazo"]
if not buildings.get(idImm): if not buildings.get(idImm):
building = Building( building = Building(
y=building.get('lat'), y=building.get("lat"),
x=building.get('lon'), x=building.get("lon"),
idImm=idImm, idImm=idImm,
numVoieImm="", numVoieImm="",
typeVoieImm="", typeVoieImm="",
@ -57,11 +64,15 @@ class Liazo:
codePostal="", codePostal="",
commune="", commune="",
bat_info="", bat_info="",
found_in = ["liazo"], found_in=["liazo"],
etat_imm_priority=4, etat_imm_priority=4,
fdnEligStatus=fdnEligStatus, fdnEligStatus=fdnEligStatus,
aquilenetEligStatus=FAIEligibilityStatus(isEligible=False, reasonNotEligible="", ftthStatus=""), aquilenetEligStatus=FAIEligibilityStatus(
othersEligStatus=FAIEligibilityStatus(isEligible=False, reasonNotEligible="", ftthStatus=""), isEligible=False, reasonNotEligible="", ftthStatus=""
),
othersEligStatus=FAIEligibilityStatus(
isEligible=False, reasonNotEligible="", ftthStatus=""
),
) )
buildings[idImm] = building buildings[idImm] = building