MCPcopy Index your code
hub / github.com/RustPython/RustPython / getfqdn

Function getfqdn

Lib/socket.py:799–823  ·  view source on GitHub ↗

Get fully qualified domain name from name. An empty argument is interpreted as meaning the local host. First the hostname returned by gethostbyaddr() is checked, then possibly existing aliases. In case no FQDN is available and `name` was given, it is returned unchanged. If `name` w

(name='')

Source from the content-addressed store, hash-verified

797
798
799def getfqdn(name=''):
800 """Get fully qualified domain name from name.
801
802 An empty argument is interpreted as meaning the local host.
803
804 First the hostname returned by gethostbyaddr() is checked, then
805 possibly existing aliases. In case no FQDN is available and `name`
806 was given, it is returned unchanged. If `name` was empty, '0.0.0.0' or '::',
807 hostname from gethostname() is returned.
808 """
809 name = name.strip()
810 if not name or name in ('0.0.0.0', '::'):
811 name = gethostname()
812 try:
813 hostname, aliases, ipaddrs = gethostbyaddr(name)
814 except error:
815 pass
816 else:
817 aliases.insert(0, hostname)
818 for name in aliases:
819 if '.' in name:
820 break
821 else:
822 name = hostname
823 return name
824
825
826_GLOBAL_DEFAULT_TIMEOUT = object()

Callers

nothing calls this directly

Calls 4

gethostbyaddrFunction · 0.85
gethostnameFunction · 0.50
stripMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected