In [2]:
#may be you will need to execute in your console a : pip install tld
from tld import get_tld
# first let's assign an url
url = 'https://en.wikipedia.org/wiki/List_of_countries_and_dependencies_by_population#See_also?id=1'
server = get_tld(url)
print server
In [4]:
import socket
ipaddres = socket.gethostbyname(server)
print ipaddres
In [ ]: