Обновить yandex_way_mp.py
This commit is contained in:
parent
925aee9132
commit
b07a094f34
@ -67,7 +67,7 @@ def process_records(records, apikey, queue):
|
|||||||
origins = f"{record[2]},{record[3]}"
|
origins = f"{record[2]},{record[3]}"
|
||||||
destinations = f"{record[5]},{record[6]}"
|
destinations = f"{record[5]},{record[6]}"
|
||||||
params = {'origins': origins, 'destinations': destinations, 'apikey': apikey, 'departure_time': dep_time}
|
params = {'origins': origins, 'destinations': destinations, 'apikey': apikey, 'departure_time': dep_time}
|
||||||
response = requests.get('https://api.routing.yandex.net/v2/distancematrix', params=params)
|
response = requests.get('https://api.routing.yandex.net/v2/distancematrix', params=params, timeout=5)
|
||||||
route_json = response.json()
|
route_json = response.json()
|
||||||
cursor.execute("BEGIN flm_office.add_way_log(:1, :2, :3, :4); END;",
|
cursor.execute("BEGIN flm_office.add_way_log(:1, :2, :3, :4); END;",
|
||||||
[record[0], response.status_code, response.url, json.dumps(route_json)])
|
[record[0], response.status_code, response.url, json.dumps(route_json)])
|
||||||
@ -123,9 +123,9 @@ def process_data():
|
|||||||
terminate_processes(processes)
|
terminate_processes(processes)
|
||||||
processes.clear()
|
processes.clear()
|
||||||
|
|
||||||
start_next_pool = 10
|
# start_next_pool = 10
|
||||||
logging.info(f"End pool, wait {start_next_pool} seconds")
|
# logging.info(f"End pool, wait {start_next_pool} seconds")
|
||||||
time.sleep(start_next_pool)
|
# time.sleep(start_next_pool)
|
||||||
|
|
||||||
terminate_processes(processes)
|
terminate_processes(processes)
|
||||||
processes.clear()
|
processes.clear()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user