Force IPv4 usage

This commit is contained in:
Alexander Borsuk 2022-10-07 23:21:08 +02:00
parent 15d3fcc149
commit 06fc8bc13c

View file

@ -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];('