def test_get_bulk_asn_whois(self): ips = [ '74.125.225.229', # ARIN '2001:4860:4860::8888', '62.239.237.1', # RIPE '2a00:2381:ffff::1', '210.107.73.73', # APNIC '2001:240:10c:1::ca20:9d1d', '200.57.141.161', # LACNIC '2801:10:c000::', '196.11.240.215', # AFRINIC '2001:43f8:7b0::', '133.1.2.5', # JPNIC '115.1.2.3' # KRNIC ] try: self.assertIsInstance(get_bulk_asn_whois(addresses=ips), str) except ASNLookupError: pass except AssertionError as e: raise e except Exception as e: self.fail('Unexpected exception raised: {0}'.format(e))
def test_get_bulk_asn_whois(self): ips = (list(ipv4_generate_random(500)) + list(ipv6_generate_random(500))) try: self.assertIsInstance(get_bulk_asn_whois(addresses=ips), str) except ASNLookupError: pass except AssertionError as e: raise e except Exception as e: self.fail('Unexpected exception raised: {0}'.format(e))
'\'2a00:2381:ffff::1\', \'210.107.73.73\', ' '\'2001:240:10c:1::ca20:9d1d\', \'200.57.141.161\', ' '\'2801:10:c000::\', \'196.11.240.215\', \'2001:43f8:7b0::\', ' '\'133.1.2.5\', \'115.1.2.3\']\n' ' >>>> results = get_bulk_asn_whois(addresses=ip_list)\n' ' >>>> pprint(results.split(\'\\\\n\'))\n\n' ' {0}' ), 'queries': { '0': lambda: get_bulk_asn_whois([ '74.125.225.229', # ARIN '2001:4860:4860::8888', '62.239.237.1', # RIPE '2a00:2381:ffff::1', '210.107.73.73', # APNIC '2001:240:10c:1::ca20:9d1d', '200.57.141.161', # LACNIC '2801:10:c000::', '196.11.240.215', # AFRINIC '2001:43f8:7b0::', '133.1.2.5', # JPNIC '115.1.2.3' # KRNIC ]).split('\n'), } }, 'BULK_LOOKUP_RDAP_OUTPUT_BASIC': { 'content': ( '::\n\n' ' >>>> from ipwhois.experimental import bulk_lookup_rdap\n' ' >>>> from pprint import pprint\n\n' ' >>>> ip_list = [\'74.125.225.229\', ' '\'2001:4860:4860::8888\', \'62.239.237.1\', '
from ipwhois.experimental import get_bulk_asn_whois from pprint import pprint ip_list = [ '115.70.29.153', '172.217.17.142', '65.52.139.168', '52.114.32.7', '86.160.212.47', '83.28.65.1', '5.196.71.125', '185.21.217.81', '239.255.255.250', '93.184.220.29' ] ip = ['40.79.65.235'] results = get_bulk_asn_whois(addresses=ip_list) pprint(results.split('\n'))