From 8f6e1348229ca48c0f5fb66aa16e70be6ceeb930 Mon Sep 17 00:00:00 2001 From: ValdikSS Date: Sat, 22 Apr 2017 17:49:56 +0300 Subject: [PATCH] Thoroughful IPv6 address update --- blockcheck.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/blockcheck.py b/blockcheck.py index e399282..4304f6c 100755 --- a/blockcheck.py +++ b/blockcheck.py @@ -498,13 +498,15 @@ def test_http_access(by_ip=False): print("\tОткрываем ", site) # First try to resolve IP address using Google API. # Use a static one if this did not work. - if by_ip and not ipv6_available: + if by_ip: domain = list(urllib.parse.urlsplit(site))[1] newip = _get_a_record_over_google_api(domain) - newipv6 = _get_a_record_over_google_api(domain, 'AAAA') + if ipv6_available: + newipv6 = _get_a_record_over_google_api(domain, 'AAAA') + if newip: sites[site]['ip'] = newip[0] - if newipv6: + if ipv6_available and newipv6: sites[site]['ipv6'] = '[' + newipv6[0] + ']' if ipv6_available: