API

class cymruwhois.Client(host='whois.cymru.com', port=43, memcache_host='localhost:11211')

Python interface to whois.cymru.com

Usage

>>> import socket
>>> ip = socket.gethostbyname("www.google.com")
>>> from cymruwhois import Client
>>> c=Client()
>>> r=c.lookup(ip)
>>> print(r.asn)
15169
>>> print(r.owner)
GOOGLE - Google Inc., US
>>> 
>>> for r in c.lookupmany([ip, "8.8.8.8"]):
...     print(r.owner)
GOOGLE - Google Inc., US
GOOGLE - Google Inc., US
lookup(ip)

Look up a single address.

Warning

Do not call this function inside of a loop, the performance will be terrible. Instead, call lookupmany or lookupmany_dict

lookupmany(ips)

Look up many ip addresses

lookupmany_dict(ips)

Look up many ip addresses, returning a dictionary of ip -> record