The whois
module does not seem to work for me, running this code gives me an error
import whois
domains = ['cnn.com']
for dom in domains:
domain = whois.Domain(dom)
print domain.registrar
This throws this error:
Traceback (most recent call last):
File "C:\Python27\Practice\2.py", line 5, in
domain = whois.Domain(dom)
File "C:\Python27\lib\site-packages\whois_3_adjust.py", line 12, in init
self.name = data['domain_name'][0].strip().lower()
TypeError: string indices must be integers, not str
Tried this query as well:
import whois
var = whois.query('google.com')
print var
C:\Python27\python.exe C/Test.py
Traceback (most recent call last):
File "C:/Test.py", line 2, in <module>
var = whois.query('google.com')
File "C:\Python27\lib\site-packages\whois\__init__.py", line 50, in query
pd = do_parse(do_query(d, force, cache_file, slow_down, ignore_returncode), tld)
File "C:\Python27\lib\site-packages\whois\_1_query.py", line 44, in do_query
_do_whois_query(dl, ignore_returncode),
File "C:\Python27\lib\site-packages\whois\_1_query.py", line 58, in _do_whois_query
p = subprocess.Popen(['whois', '.'.join(dl)], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
File "C:\Python27\lib\subprocess.py", line 711, in __init__
errread, errwrite)
File "C:\Python27\lib\subprocess.py", line 959, in _execute_child
startupinfo)
WindowsError: [Error 2]
Process finished with exit code 1