diff --git a/process_subways.py b/process_subways.py index 1a25207..a64e791 100755 --- a/process_subways.py +++ b/process_subways.py @@ -25,6 +25,17 @@ from subway_structure import ( MODES_RAPID, ) +# Hack to always use IPv4. +import socket + +old_getaddrinfo = socket.getaddrinfo +def new_getaddrinfo(*args, **kwargs): + responses = old_getaddrinfo(*args, **kwargs) + return [response + for response in responses + if response[0] == socket.AF_INET] +socket.getaddrinfo = new_getaddrinfo + def overpass_request(overground, overpass_api, bboxes): query = '[out:json][timeout:1000];('