Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
Returns the FQDN for the given IP if resolvable, otherwise None.
        

        def getFQDN(ip):
	"""Returns the FQDN for the given IP if resolvable, otherwise None.
	"""
	try:
		hn, al, ip = socket.gethostbyaddr(ip)
	except socket.herror, param:
		if param[0] == 1:
			return None
		else:
			raise param
	hn_new = socket.getfqdn(hn)
	num = hn_new.count(".")
	if num < 2:
		return None
	else:
		return hn_new
        


src/s/f/sftf-HEAD/SFTF.py   sftf(Download)
from TestResult import TestResult, getResultString
import sys, os, getopt, traceback, socket, py_compile
from NetworkEventHandler import getHostNameIP, getFQDN, checkIPv6Support
 
def resToCol(res):
			Config.LOCAL_IP = ip
	elif (Config.LOCAL_IP != "") and (Config.LOCAL_HOSTNAME == ""):
		hn = getFQDN(Config.LOCAL_IP)
		if hn is None:
			print "Failed to lookup the hostname for the given IP ('" + str(Config.LOCAL_IP) + "') from Config.py\r\nPlease fix the IP or specify the full qualified domain hostname as LOCAL_HOSTNAME in Config.py"