doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
site — Site-specific configuration hook Source code: Lib/site.py This module is automatically imported during initialization. The automatic import can be suppressed using the interpreter’s -S option. Importing this module will append site-specific paths to the module search path and add a few builtins, unless -S was us...
python.library.site
site.addsitedir(sitedir, known_paths=None) Add a directory to sys.path and process its .pth files. Typically used in sitecustomize or usercustomize (see above).
python.library.site#site.addsitedir
site.ENABLE_USER_SITE Flag showing the status of the user site-packages directory. True means that it is enabled and was added to sys.path. False means that it was disabled by user request (with -s or PYTHONNOUSERSITE). None means it was disabled for security reasons (mismatch between user or group id and effective i...
python.library.site#site.ENABLE_USER_SITE
site.getsitepackages() Return a list containing all global site-packages directories. New in version 3.2.
python.library.site#site.getsitepackages
site.getuserbase() Return the path of the user base directory, USER_BASE. If it is not initialized yet, this function will also set it, respecting PYTHONUSERBASE. New in version 3.2.
python.library.site#site.getuserbase
site.getusersitepackages() Return the path of the user-specific site-packages directory, USER_SITE. If it is not initialized yet, this function will also set it, respecting USER_BASE. To determine if the user-specific site-packages was added to sys.path ENABLE_USER_SITE should be used. New in version 3.2.
python.library.site#site.getusersitepackages
site.main() Adds all the standard site-specific directories to the module search path. This function is called automatically when this module is imported, unless the Python interpreter was started with the -S flag. Changed in version 3.3: This function used to be called unconditionally.
python.library.site#site.main
site.PREFIXES A list of prefixes for site-packages directories.
python.library.site#site.PREFIXES
site.USER_BASE Path to the base directory for the user site-packages. Can be None if getuserbase() hasn’t been called yet. Default value is ~/.local for UNIX and Mac OS X non-framework builds, ~/Library/Python/X.Y for Mac framework builds, and %APPDATA%\Python for Windows. This value is used by Distutils to compute t...
python.library.site#site.USER_BASE
site.USER_SITE Path to the user site-packages for the running Python. Can be None if getusersitepackages() hasn’t been called yet. Default value is ~/.local/lib/pythonX.Y/site-packages for UNIX and non-framework Mac OS X builds, ~/Library/Python/X.Y/lib/python/site-packages for Mac framework builds, and %APPDATA%\Pyt...
python.library.site#site.USER_SITE
class slice(stop) class slice(start, stop[, step]) Return a slice object representing the set of indices specified by range(start, stop, step). The start and step arguments default to None. Slice objects have read-only data attributes start, stop and step which merely return the argument values (or their default). ...
python.library.functions#slice
smtpd — SMTP Server Source code: Lib/smtpd.py This module offers several classes to implement SMTP (email) servers. See also The aiosmtpd package is a recommended replacement for this module. It is based on asyncio and provides a more straightforward API. smtpd should be considered deprecated. Several server implemen...
python.library.smtpd
class smtpd.DebuggingServer(localaddr, remoteaddr) Create a new debugging server. Arguments are as per SMTPServer. Messages will be discarded, and printed on stdout.
python.library.smtpd#smtpd.DebuggingServer
class smtpd.MailmanProxy(localaddr, remoteaddr) Deprecated since version 3.9, will be removed in version 3.11: MailmanProxy is deprecated, it depends on a Mailman module which no longer exists and therefore is already broken. Create a new pure proxy server. Arguments are as per SMTPServer. Everything will be relaye...
python.library.smtpd#smtpd.MailmanProxy
class smtpd.PureProxy(localaddr, remoteaddr) Create a new pure proxy server. Arguments are as per SMTPServer. Everything will be relayed to remoteaddr. Note that running this has a good chance to make you into an open relay, so please be careful.
python.library.smtpd#smtpd.PureProxy
class smtpd.SMTPChannel(server, conn, addr, data_size_limit=33554432, map=None, enable_SMTPUTF8=False, decode_data=False) Create a new SMTPChannel object which manages the communication between the server and a single SMTP client. conn and addr are as per the instance variables described below. data_size_limit specif...
python.library.smtpd#smtpd.SMTPChannel
addr Holds the address of the client, the second value returned by socket.accept
python.library.smtpd#smtpd.SMTPChannel.addr
conn Holds the socket object connecting to the client.
python.library.smtpd#smtpd.SMTPChannel.conn
fqdn Holds the fully-qualified domain name of the server as returned by socket.getfqdn().
python.library.smtpd#smtpd.SMTPChannel.fqdn
mailfrom Holds a string containing the address identified in the “MAIL FROM:” line from the client.
python.library.smtpd#smtpd.SMTPChannel.mailfrom
peer Holds the name of the client peer as returned by conn.getpeername() where conn is conn.
python.library.smtpd#smtpd.SMTPChannel.peer
rcpttos Holds a list of strings containing the addresses identified in the “RCPT TO:” lines from the client.
python.library.smtpd#smtpd.SMTPChannel.rcpttos
received_data Holds a string containing all of the data sent by the client during the DATA state, up to but not including the terminating "\r\n.\r\n".
python.library.smtpd#smtpd.SMTPChannel.received_data
received_lines Holds a list of the line strings (decoded using UTF-8) received from the client. The lines have their "\r\n" line ending translated to "\n".
python.library.smtpd#smtpd.SMTPChannel.received_lines
seen_greeting Holds a string containing the greeting sent by the client in its “HELO”.
python.library.smtpd#smtpd.SMTPChannel.seen_greeting
smtp_server Holds the SMTPServer that spawned this channel.
python.library.smtpd#smtpd.SMTPChannel.smtp_server
smtp_state Holds the current state of the channel. This will be either COMMAND initially and then DATA after the client sends a “DATA” line.
python.library.smtpd#smtpd.SMTPChannel.smtp_state
class smtpd.SMTPServer(localaddr, remoteaddr, data_size_limit=33554432, map=None, enable_SMTPUTF8=False, decode_data=False) Create a new SMTPServer object, which binds to local address localaddr. It will treat remoteaddr as an upstream SMTP relayer. Both localaddr and remoteaddr should be a (host, port) tuple. The ob...
python.library.smtpd#smtpd.SMTPServer
channel_class Override this in subclasses to use a custom SMTPChannel for managing SMTP clients.
python.library.smtpd#smtpd.SMTPServer.channel_class
process_message(peer, mailfrom, rcpttos, data, **kwargs) Raise a NotImplementedError exception. Override this in subclasses to do something useful with this message. Whatever was passed in the constructor as remoteaddr will be available as the _remoteaddr attribute. peer is the remote host’s address, mailfrom is the ...
python.library.smtpd#smtpd.SMTPServer.process_message
smtplib — SMTP protocol client Source code: Lib/smtplib.py The smtplib module defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon. For details of SMTP and ESMTP operation, consult RFC 821 (Simple Mail Transfer Protocol) and RFC 1869 (SMTP Ser...
python.library.smtplib
class smtplib.LMTP(host='', port=LMTP_PORT, local_hostname=None, source_address=None[, timeout]) The LMTP protocol, which is very similar to ESMTP, is heavily based on the standard SMTP client. It’s common to use Unix sockets for LMTP, so our connect() method must support that as well as a regular host:port server. T...
python.library.smtplib#smtplib.LMTP
class smtplib.SMTP(host='', port=0, local_hostname=None, [timeout, ]source_address=None) An SMTP instance encapsulates an SMTP connection. It has methods that support a full repertoire of SMTP and ESMTP operations. If the optional host and port parameters are given, the SMTP connect() method is called with those para...
python.library.smtplib#smtplib.SMTP
SMTP.auth(mechanism, authobject, *, initial_response_ok=True) Issue an SMTP AUTH command for the specified authentication mechanism, and handle the challenge response via authobject. mechanism specifies which authentication mechanism is to be used as argument to the AUTH command; the valid values are those listed in ...
python.library.smtplib#smtplib.SMTP.auth
SMTP.connect(host='localhost', port=0) Connect to a host on a given port. The defaults are to connect to the local host at the standard SMTP port (25). If the hostname ends with a colon (':') followed by a number, that suffix will be stripped off and the number interpreted as the port number to use. This method is au...
python.library.smtplib#smtplib.SMTP.connect
SMTP.docmd(cmd, args='') Send a command cmd to the server. The optional argument args is simply concatenated to the command, separated by a space. This returns a 2-tuple composed of a numeric response code and the actual response line (multiline responses are joined into one long line.) In normal operation it should ...
python.library.smtplib#smtplib.SMTP.docmd
SMTP.ehlo(name='') Identify yourself to an ESMTP server using EHLO. The hostname argument defaults to the fully qualified domain name of the local host. Examine the response for ESMTP option and store them for use by has_extn(). Also sets several informational attributes: the message returned by the server is stored ...
python.library.smtplib#smtplib.SMTP.ehlo
SMTP.ehlo_or_helo_if_needed() This method calls ehlo() and/or helo() if there has been no previous EHLO or HELO command this session. It tries ESMTP EHLO first. SMTPHeloError The server didn’t reply properly to the HELO greeting.
python.library.smtplib#smtplib.SMTP.ehlo_or_helo_if_needed
SMTP.has_extn(name) Return True if name is in the set of SMTP service extensions returned by the server, False otherwise. Case is ignored.
python.library.smtplib#smtplib.SMTP.has_extn
SMTP.helo(name='') Identify yourself to the SMTP server using HELO. The hostname argument defaults to the fully qualified domain name of the local host. The message returned by the server is stored as the helo_resp attribute of the object. In normal operation it should not be necessary to call this method explicitly....
python.library.smtplib#smtplib.SMTP.helo
SMTP.login(user, password, *, initial_response_ok=True) Log in on an SMTP server that requires authentication. The arguments are the username and the password to authenticate with. If there has been no previous EHLO or HELO command this session, this method tries ESMTP EHLO first. This method will return normally if ...
python.library.smtplib#smtplib.SMTP.login
SMTP.quit() Terminate the SMTP session and close the connection. Return the result of the SMTP QUIT command.
python.library.smtplib#smtplib.SMTP.quit
SMTP.sendmail(from_addr, to_addrs, msg, mail_options=(), rcpt_options=()) Send mail. The required arguments are an RFC 822 from-address string, a list of RFC 822 to-address strings (a bare string will be treated as a list with 1 address), and a message string. The caller may pass a list of ESMTP options (such as 8bit...
python.library.smtplib#smtplib.SMTP.sendmail
SMTP.send_message(msg, from_addr=None, to_addrs=None, mail_options=(), rcpt_options=()) This is a convenience method for calling sendmail() with the message represented by an email.message.Message object. The arguments have the same meaning as for sendmail(), except that msg is a Message object. If from_addr is None ...
python.library.smtplib#smtplib.SMTP.send_message
SMTP.set_debuglevel(level) Set the debug output level. A value of 1 or True for level results in debug messages for connection and for all messages sent to and received from the server. A value of 2 for level results in these messages being timestamped. Changed in version 3.5: Added debuglevel 2.
python.library.smtplib#smtplib.SMTP.set_debuglevel
SMTP.starttls(keyfile=None, certfile=None, context=None) Put the SMTP connection in TLS (Transport Layer Security) mode. All SMTP commands that follow will be encrypted. You should then call ehlo() again. If keyfile and certfile are provided, they are used to create an ssl.SSLContext. Optional context parameter is an...
python.library.smtplib#smtplib.SMTP.starttls
SMTP.verify(address) Check the validity of an address on this server using SMTP VRFY. Returns a tuple consisting of code 250 and a full RFC 822 address (including human name) if the user address is valid. Otherwise returns an SMTP error code of 400 or greater and an error string. Note Many sites disable SMTP VRFY in...
python.library.smtplib#smtplib.SMTP.verify
exception smtplib.SMTPAuthenticationError SMTP authentication went wrong. Most probably the server didn’t accept the username/password combination provided.
python.library.smtplib#smtplib.SMTPAuthenticationError
exception smtplib.SMTPConnectError Error occurred during establishment of a connection with the server.
python.library.smtplib#smtplib.SMTPConnectError
exception smtplib.SMTPDataError The SMTP server refused to accept the message data.
python.library.smtplib#smtplib.SMTPDataError
exception smtplib.SMTPException Subclass of OSError that is the base exception class for all the other exceptions provided by this module. Changed in version 3.4: SMTPException became subclass of OSError
python.library.smtplib#smtplib.SMTPException
exception smtplib.SMTPHeloError The server refused our HELO message.
python.library.smtplib#smtplib.SMTPHeloError
exception smtplib.SMTPNotSupportedError The command or option attempted is not supported by the server. New in version 3.5.
python.library.smtplib#smtplib.SMTPNotSupportedError
exception smtplib.SMTPRecipientsRefused All recipient addresses refused. The errors for each recipient are accessible through the attribute recipients, which is a dictionary of exactly the same sort as SMTP.sendmail() returns.
python.library.smtplib#smtplib.SMTPRecipientsRefused
exception smtplib.SMTPResponseException Base class for all exceptions that include an SMTP error code. These exceptions are generated in some instances when the SMTP server returns an error code. The error code is stored in the smtp_code attribute of the error, and the smtp_error attribute is set to the error message...
python.library.smtplib#smtplib.SMTPResponseException
exception smtplib.SMTPSenderRefused Sender address refused. In addition to the attributes set by on all SMTPResponseException exceptions, this sets ‘sender’ to the string that the SMTP server refused.
python.library.smtplib#smtplib.SMTPSenderRefused
exception smtplib.SMTPServerDisconnected This exception is raised when the server unexpectedly disconnects, or when an attempt is made to use the SMTP instance before connecting it to a server.
python.library.smtplib#smtplib.SMTPServerDisconnected
class smtplib.SMTP_SSL(host='', port=0, local_hostname=None, keyfile=None, certfile=None, [timeout, ]context=None, source_address=None) An SMTP_SSL instance behaves exactly the same as instances of SMTP. SMTP_SSL should be used for situations where SSL is required from the beginning of the connection and using startt...
python.library.smtplib#smtplib.SMTP_SSL
sndhdr — Determine type of sound file Source code: Lib/sndhdr.py The sndhdr provides utility functions which attempt to determine the type of sound data which is in a file. When these functions are able to determine what type of sound data is stored in a file, they return a namedtuple(), containing five attributes: (fi...
python.library.sndhdr
sndhdr.what(filename) Determines the type of sound data stored in the file filename using whathdr(). If it succeeds, returns a namedtuple as described above, otherwise None is returned. Changed in version 3.5: Result changed from a tuple to a namedtuple.
python.library.sndhdr#sndhdr.what
sndhdr.whathdr(filename) Determines the type of sound data stored in a file based on the file header. The name of the file is given by filename. This function returns a namedtuple as described above on success, or None. Changed in version 3.5: Result changed from a tuple to a namedtuple.
python.library.sndhdr#sndhdr.whathdr
socket — Low-level networking interface Source code: Lib/socket.py This module provides access to the BSD socket interface. It is available on all modern Unix systems, Windows, MacOS, and probably additional platforms. Note Some behavior may be platform dependent, since calls are made to the operating system socket AP...
python.library.socket
socket.AF_ALG socket.SOL_ALG ALG_* Constants for Linux Kernel cryptography. Availability: Linux >= 2.6.38. New in version 3.6.
python.library.socket#socket.AF_ALG
socket.AF_CAN socket.PF_CAN SOL_CAN_* CAN_* Many constants of these forms, documented in the Linux documentation, are also defined in the socket module. Availability: Linux >= 2.6.25. New in version 3.3.
python.library.socket#socket.AF_CAN
socket.AF_UNIX socket.AF_INET socket.AF_INET6 These constants represent the address (and protocol) families, used for the first argument to socket(). If the AF_UNIX constant is not defined then this protocol is unsupported. More constants may be available depending on the system.
python.library.socket#socket.AF_INET
socket.AF_UNIX socket.AF_INET socket.AF_INET6 These constants represent the address (and protocol) families, used for the first argument to socket(). If the AF_UNIX constant is not defined then this protocol is unsupported. More constants may be available depending on the system.
python.library.socket#socket.AF_INET6
socket.AF_LINK Availability: BSD, OSX. New in version 3.4.
python.library.socket#socket.AF_LINK
socket.AF_PACKET socket.PF_PACKET PACKET_* Many constants of these forms, documented in the Linux documentation, are also defined in the socket module. Availability: Linux >= 2.2.
python.library.socket#socket.AF_PACKET
socket.AF_QIPCRTR Constant for Qualcomm’s IPC router protocol, used to communicate with service providing remote processors. Availability: Linux >= 4.7.
python.library.socket#socket.AF_QIPCRTR
socket.AF_RDS socket.PF_RDS socket.SOL_RDS RDS_* Many constants of these forms, documented in the Linux documentation, are also defined in the socket module. Availability: Linux >= 2.6.30. New in version 3.3.
python.library.socket#socket.AF_RDS
socket.AF_UNIX socket.AF_INET socket.AF_INET6 These constants represent the address (and protocol) families, used for the first argument to socket(). If the AF_UNIX constant is not defined then this protocol is unsupported. More constants may be available depending on the system.
python.library.socket#socket.AF_UNIX
socket.AF_VSOCK socket.IOCTL_VM_SOCKETS_GET_LOCAL_CID VMADDR* SO_VM* Constants for Linux host/guest communication. Availability: Linux >= 4.8. New in version 3.7.
python.library.socket#socket.AF_VSOCK
socket.BDADDR_ANY socket.BDADDR_LOCAL These are string constants containing Bluetooth addresses with special meanings. For example, BDADDR_ANY can be used to indicate any address when specifying the binding socket with BTPROTO_RFCOMM.
python.library.socket#socket.BDADDR_ANY
socket.BDADDR_ANY socket.BDADDR_LOCAL These are string constants containing Bluetooth addresses with special meanings. For example, BDADDR_ANY can be used to indicate any address when specifying the binding socket with BTPROTO_RFCOMM.
python.library.socket#socket.BDADDR_LOCAL
socket.CAN_BCM CAN_BCM_* CAN_BCM, in the CAN protocol family, is the broadcast manager (BCM) protocol. Broadcast manager constants, documented in the Linux documentation, are also defined in the socket module. Availability: Linux >= 2.6.25. Note The CAN_BCM_CAN_FD_FRAME flag is only available on Linux >= 4.8. Ne...
python.library.socket#socket.CAN_BCM
socket.CAN_ISOTP CAN_ISOTP, in the CAN protocol family, is the ISO-TP (ISO 15765-2) protocol. ISO-TP constants, documented in the Linux documentation. Availability: Linux >= 2.6.25. New in version 3.7.
python.library.socket#socket.CAN_ISOTP
socket.CAN_J1939 CAN_J1939, in the CAN protocol family, is the SAE J1939 protocol. J1939 constants, documented in the Linux documentation. Availability: Linux >= 5.4. New in version 3.9.
python.library.socket#socket.CAN_J1939
socket.CAN_RAW_FD_FRAMES Enables CAN FD support in a CAN_RAW socket. This is disabled by default. This allows your application to send both CAN and CAN FD frames; however, you must accept both CAN and CAN FD frames when reading from the socket. This constant is documented in the Linux documentation. Availability: Lin...
python.library.socket#socket.CAN_RAW_FD_FRAMES
socket.CAN_RAW_JOIN_FILTERS Joins the applied CAN filters such that only CAN frames that match all given CAN filters are passed to user space. This constant is documented in the Linux documentation. Availability: Linux >= 4.1. New in version 3.9.
python.library.socket#socket.CAN_RAW_JOIN_FILTERS
socket.close(fd) Close a socket file descriptor. This is like os.close(), but for sockets. On some platforms (most noticeable Windows) os.close() does not work for socket file descriptors. New in version 3.7.
python.library.socket#socket.close
socket.CMSG_LEN(length) Return the total length, without trailing padding, of an ancillary data item with associated data of the given length. This value can often be used as the buffer size for recvmsg() to receive a single item of ancillary data, but RFC 3542 requires portable applications to use CMSG_SPACE() and t...
python.library.socket#socket.CMSG_LEN
socket.CMSG_SPACE(length) Return the buffer size needed for recvmsg() to receive an ancillary data item with associated data of the given length, along with any trailing padding. The buffer space needed to receive multiple items is the sum of the CMSG_SPACE() values for their associated data lengths. Raises OverflowE...
python.library.socket#socket.CMSG_SPACE
socket.create_connection(address[, timeout[, source_address]]) Connect to a TCP service listening on the Internet address (a 2-tuple (host, port)), and return the socket object. This is a higher-level function than socket.connect(): if host is a non-numeric hostname, it will try to resolve it for both AF_INET and AF_...
python.library.socket#socket.create_connection
socket.create_server(address, *, family=AF_INET, backlog=None, reuse_port=False, dualstack_ipv6=False) Convenience function which creates a TCP socket bound to address (a 2-tuple (host, port)) and return the socket object. family should be either AF_INET or AF_INET6. backlog is the queue size passed to socket.listen(...
python.library.socket#socket.create_server
exception socket.error A deprecated alias of OSError. Changed in version 3.3: Following PEP 3151, this class was made an alias of OSError.
python.library.socket#socket.error
socket.fromfd(fd, family, type, proto=0) Duplicate the file descriptor fd (an integer as returned by a file object’s fileno() method) and build a socket object from the result. Address family, socket type and protocol number are as for the socket() function above. The file descriptor should refer to a socket, but thi...
python.library.socket#socket.fromfd
socket.fromshare(data) Instantiate a socket from data obtained from the socket.share() method. The socket is assumed to be in blocking mode. Availability: Windows. New in version 3.3.
python.library.socket#socket.fromshare
exception socket.gaierror A subclass of OSError, this exception is raised for address-related errors by getaddrinfo() and getnameinfo(). The accompanying value is a pair (error, string) representing an error returned by a library call. string represents the description of error, as returned by the gai_strerror() C fu...
python.library.socket#socket.gaierror
socket.getaddrinfo(host, port, family=0, type=0, proto=0, flags=0) Translate the host/port argument into a sequence of 5-tuples that contain all the necessary arguments for creating a socket connected to that service. host is a domain name, a string representation of an IPv4/v6 address or None. port is a string servi...
python.library.socket#socket.getaddrinfo
socket.getdefaulttimeout() Return the default timeout in seconds (float) for new socket objects. A value of None indicates that new socket objects have no timeout. When the socket module is first imported, the default is None.
python.library.socket#socket.getdefaulttimeout
socket.getfqdn([name]) Return a fully qualified domain name for name. If name is omitted or empty, it is interpreted as the local host. To find the fully qualified name, the hostname returned by gethostbyaddr() is checked, followed by aliases for the host, if available. The first name which includes a period is selec...
python.library.socket#socket.getfqdn
socket.gethostbyaddr(ip_address) Return a triple (hostname, aliaslist, ipaddrlist) where hostname is the primary host name responding to the given ip_address, aliaslist is a (possibly empty) list of alternative host names for the same address, and ipaddrlist is a list of IPv4/v6 addresses for the same interface on th...
python.library.socket#socket.gethostbyaddr
socket.gethostbyname(hostname) Translate a host name to IPv4 address format. The IPv4 address is returned as a string, such as '100.50.200.5'. If the host name is an IPv4 address itself it is returned unchanged. See gethostbyname_ex() for a more complete interface. gethostbyname() does not support IPv6 name resolutio...
python.library.socket#socket.gethostbyname
socket.gethostbyname_ex(hostname) Translate a host name to IPv4 address format, extended interface. Return a triple (hostname, aliaslist, ipaddrlist) where hostname is the primary host name responding to the given ip_address, aliaslist is a (possibly empty) list of alternative host names for the same address, and ipa...
python.library.socket#socket.gethostbyname_ex
socket.gethostname() Return a string containing the hostname of the machine where the Python interpreter is currently executing. Raises an auditing event socket.gethostname with no arguments. Note: gethostname() doesn’t always return the fully qualified domain name; use getfqdn() for that.
python.library.socket#socket.gethostname
socket.getnameinfo(sockaddr, flags) Translate a socket address sockaddr into a 2-tuple (host, port). Depending on the settings of flags, the result can contain a fully-qualified domain name or numeric address representation in host. Similarly, port can contain a string port name or a numeric port number. For IPv6 add...
python.library.socket#socket.getnameinfo
socket.getprotobyname(protocolname) Translate an Internet protocol name (for example, 'icmp') to a constant suitable for passing as the (optional) third argument to the socket() function. This is usually only needed for sockets opened in “raw” mode (SOCK_RAW); for the normal socket modes, the correct protocol is chos...
python.library.socket#socket.getprotobyname
socket.getservbyname(servicename[, protocolname]) Translate an Internet service name and protocol name to a port number for that service. The optional protocol name, if given, should be 'tcp' or 'udp', otherwise any protocol will match. Raises an auditing event socket.getservbyname with arguments servicename, protoco...
python.library.socket#socket.getservbyname
socket.getservbyport(port[, protocolname]) Translate an Internet port number and protocol name to a service name for that service. The optional protocol name, if given, should be 'tcp' or 'udp', otherwise any protocol will match. Raises an auditing event socket.getservbyport with arguments port, protocolname.
python.library.socket#socket.getservbyport
socket.has_dualstack_ipv6() Return True if the platform supports creating a TCP socket which can handle both IPv4 and IPv6 connections. New in version 3.8.
python.library.socket#socket.has_dualstack_ipv6