def gethostbyaddr(space, host): """gethostbyaddr(host) -> (name, aliaslist, addresslist) Return the true host name, a list of aliases, and a list of IP addresses, for a host. The host argument is a string giving a host name or IP number. """ try: res = rsocket.gethostbyaddr(host) except SocketError, e: raise converted_error(space, e)
def gethostbyaddr(space, w_host): """gethostbyaddr(host) -> (name, aliaslist, addresslist) Return the true host name, a list of aliases, and a list of IP addresses, for a host. The host argument is a string giving a host name or IP number. """ host = encode_idna(space, w_host) try: res = rsocket.gethostbyaddr(host) except SocketError as e: raise converted_error(space, e) return common_wrapgethost(space, res)
def gethostbyaddr(space, ip_address): """ Get the Internet host name corresponding to a given IP address""" h, _, _ = rsocket.gethostbyaddr(ip_address) return space.newstr(h)