Add retrying logic
This commit is contained in:
parent
210f57f6fa
commit
cd74ff6f32
@ -46,6 +46,7 @@ import os
|
||||
import sys
|
||||
|
||||
import requests
|
||||
from retrying import retry
|
||||
|
||||
|
||||
def main(base_url, api_key, source_file, json_columns):
|
||||
@ -70,6 +71,7 @@ def main(base_url, api_key, source_file, json_columns):
|
||||
print('DEBUG', building_id, response_code, response_data)
|
||||
|
||||
|
||||
@retry(wait_exponential_multiplier=1000, wait_exponential_max=10000)
|
||||
def update_building(building_id, data, api_key, base_url):
|
||||
"""Save data to a building
|
||||
"""
|
||||
@ -104,6 +106,7 @@ def find_building(data, base_url):
|
||||
return None
|
||||
|
||||
|
||||
@retry(wait_exponential_multiplier=1000, wait_exponential_max=10000)
|
||||
def find_by_reference(base_url, ref_key, ref_id):
|
||||
"""Find building_id by TOID or UPRN
|
||||
"""
|
||||
|
@ -3,3 +3,4 @@ fiona==1.7.13
|
||||
osmnx==0.8.1
|
||||
psycopg2==2.7.5
|
||||
shapely==1.6.4
|
||||
retrying==1.3.3
|
||||
|
Loading…
Reference in New Issue
Block a user