Sample code for 30+ languages & platforms
CkPython

DNS Lookup

Do a DNS lookup to resolve a hostname to an IP address.

Chilkat CkPython Downloads

CkPython
import sys
import chilkat

# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

socket = chilkat.CkSocket()

maxWaitMs = 10000
ipAddr = socket.dnsLookup("www.chilkatsoft.com",maxWaitMs)
if (socket.get_LastMethodSuccess() != True):
    print(socket.lastErrorText())
    sys.exit()

print("IP Address: " + ipAddr)