création du main

This commit is contained in:
SebF 2021-10-09 14:31:01 +02:00
parent 3a786f0f68
commit eeac2f26aa

View File

@ -261,20 +261,20 @@ def sauvegarde_ods(overpass_query_fields, data, nom_req):
print("Sauvegarde résultats format ODS pour " + nom_req) print("Sauvegarde résultats format ODS pour " + nom_req)
def main():
for req in requetes.reqs: for req in requetes.reqs:
for nb_essai in range(max_retry): for nb_essai in range(max_retry):
# on tente max_retry fois # on tente max_retry fois
try: try:
executer_requete_et_exporter_resultats(
executer_requete_et_exporter_resultats(req.nom, req.critere, aire_de_recherche, req.champs) req.nom, req.critere, aire_de_recherche, req.champs
)
break break
except errors.Api_error: except errors.Api_error:
if (nb_essai == max_retry) : if nb_essai == max_retry:
print("trop d'erreurs d'API - abandon") print("trop d'erreurs d'API - abandon")
exit() exit()
@ -282,6 +282,8 @@ for req in requetes.reqs :
time.sleep(retry_delay) time.sleep(retry_delay)
print("Fini") print("Fini")
if __name__ == "__main__":
main()