fix: return host and port for IPv4 address

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
sammachin-gprs
Alan Shaw 2018-09-02 11:49:29 +01:00
parent 2aeb0434da
commit d430751202
No known key found for this signature in database
GPG Key ID: 101D1B7A03DFAD4C
1 changed files with 1 additions and 3 deletions

View File

@ -200,7 +200,7 @@ def open_http_socket(method, url, json=None, timeout=None, headers=None, data=No
def get_address_info(host, port, retries_left = 20):
try:
if is_ipv4_address(host):
addr = (host, port)
return (host, port)
else:
return usocket.getaddrinfo(host, port)[0][4]
except OSError as e:
@ -268,5 +268,3 @@ def is_ipv4_address(address):
return len(valid_octets) == 4
except Exception:
return False