création du main
This commit is contained in:
parent
3a786f0f68
commit
eeac2f26aa
@ -261,27 +261,29 @@ 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)
|
||||||
|
|
||||||
|
|
||||||
for req in requetes.reqs :
|
def main():
|
||||||
|
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:
|
||||||
|
print("trop d'erreurs d'API - abandon")
|
||||||
if (nb_essai == max_retry) :
|
|
||||||
print ("trop d'erreurs d'API - abandon")
|
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
print ("erreur API - on retente dans "+str(retry_delay)+"s")
|
print("erreur API - on retente dans " + str(retry_delay) + "s")
|
||||||
|
|
||||||
time.sleep(retry_delay)
|
time.sleep(retry_delay)
|
||||||
|
|
||||||
|
print("Fini")
|
||||||
|
|
||||||
|
|
||||||
print("Fini")
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user