doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
SSLSocket.context The SSLContext object this SSL socket is tied to. If the SSL socket was created using the deprecated wrap_socket() function (rather than SSLContext.wrap_socket()), this is a custom context object created for this SSL socket. New in version 3.2.
python.library.ssl#ssl.SSLSocket.context
SSLSocket.do_handshake() Perform the SSL setup handshake. Changed in version 3.4: The handshake method also performs match_hostname() when the check_hostname attribute of the socket’s context is true. Changed in version 3.5: The socket timeout is no more reset each time bytes are received or sent. The socket timeout is now to maximum total duration of the handshake. Changed in version 3.7: Hostname or IP address is matched by OpenSSL during handshake. The function match_hostname() is no longer used. In case OpenSSL refuses a hostname or IP address, the handshake is aborted early and a TLS alert message is send to the peer.
python.library.ssl#ssl.SSLSocket.do_handshake
SSLSocket.getpeercert(binary_form=False) If there is no certificate for the peer on the other end of the connection, return None. If the SSL handshake hasn’t been done yet, raise ValueError. If the binary_form parameter is False, and a certificate was received from the peer, this method returns a dict instance. If the certificate was not validated, the dict is empty. If the certificate was validated, it returns a dict with several keys, amongst them subject (the principal for which the certificate was issued) and issuer (the principal issuing the certificate). If a certificate contains an instance of the Subject Alternative Name extension (see RFC 3280), there will also be a subjectAltName key in the dictionary. The subject and issuer fields are tuples containing the sequence of relative distinguished names (RDNs) given in the certificate’s data structure for the respective fields, and each RDN is a sequence of name-value pairs. Here is a real-world example: {'issuer': ((('countryName', 'IL'),), (('organizationName', 'StartCom Ltd.'),), (('organizationalUnitName', 'Secure Digital Certificate Signing'),), (('commonName', 'StartCom Class 2 Primary Intermediate Server CA'),)), 'notAfter': 'Nov 22 08:15:19 2013 GMT', 'notBefore': 'Nov 21 03:09:52 2011 GMT', 'serialNumber': '95F0', 'subject': ((('description', '571208-SLe257oHY9fVQ07Z'),), (('countryName', 'US'),), (('stateOrProvinceName', 'California'),), (('localityName', 'San Francisco'),), (('organizationName', 'Electronic Frontier Foundation, Inc.'),), (('commonName', '*.eff.org'),), (('emailAddress', 'hostmaster@eff.org'),)), 'subjectAltName': (('DNS', '*.eff.org'), ('DNS', 'eff.org')), 'version': 3} Note To validate a certificate for a particular service, you can use the match_hostname() function. If the binary_form parameter is True, and a certificate was provided, this method returns the DER-encoded form of the entire certificate as a sequence of bytes, or None if the peer did not provide a certificate. Whether the peer provides a certificate depends on the SSL socket’s role: for a client SSL socket, the server will always provide a certificate, regardless of whether validation was required; for a server SSL socket, the client will only provide a certificate when requested by the server; therefore getpeercert() will return None if you used CERT_NONE (rather than CERT_OPTIONAL or CERT_REQUIRED). Changed in version 3.2: The returned dictionary includes additional items such as issuer and notBefore. Changed in version 3.4: ValueError is raised when the handshake isn’t done. The returned dictionary includes additional X509v3 extension items such as crlDistributionPoints, caIssuers and OCSP URIs. Changed in version 3.9: IPv6 address strings no longer have a trailing new line.
python.library.ssl#ssl.SSLSocket.getpeercert
SSLSocket.get_channel_binding(cb_type="tls-unique") Get channel binding data for current connection, as a bytes object. Returns None if not connected or the handshake has not been completed. The cb_type parameter allow selection of the desired channel binding type. Valid channel binding types are listed in the CHANNEL_BINDING_TYPES list. Currently only the ‘tls-unique’ channel binding, defined by RFC 5929, is supported. ValueError will be raised if an unsupported channel binding type is requested. New in version 3.3.
python.library.ssl#ssl.SSLSocket.get_channel_binding
SSLSocket.pending() Returns the number of already decrypted bytes available for read, pending on the connection.
python.library.ssl#ssl.SSLSocket.pending
SSLSocket.read(len=1024, buffer=None) Read up to len bytes of data from the SSL socket and return the result as a bytes instance. If buffer is specified, then read into the buffer instead, and return the number of bytes read. Raise SSLWantReadError or SSLWantWriteError if the socket is non-blocking and the read would block. As at any time a re-negotiation is possible, a call to read() can also cause write operations. Changed in version 3.5: The socket timeout is no more reset each time bytes are received or sent. The socket timeout is now to maximum total duration to read up to len bytes. Deprecated since version 3.6: Use recv() instead of read().
python.library.ssl#ssl.SSLSocket.read
SSLSocket.selected_alpn_protocol() Return the protocol that was selected during the TLS handshake. If SSLContext.set_alpn_protocols() was not called, if the other party does not support ALPN, if this socket does not support any of the client’s proposed protocols, or if the handshake has not happened yet, None is returned. New in version 3.5.
python.library.ssl#ssl.SSLSocket.selected_alpn_protocol
SSLSocket.selected_npn_protocol() Return the higher-level protocol that was selected during the TLS/SSL handshake. If SSLContext.set_npn_protocols() was not called, or if the other party does not support NPN, or if the handshake has not yet happened, this will return None. New in version 3.3.
python.library.ssl#ssl.SSLSocket.selected_npn_protocol
SSLSocket.server_hostname Hostname of the server: str type, or None for server-side socket or if the hostname was not specified in the constructor. New in version 3.2. Changed in version 3.7: The attribute is now always ASCII text. When server_hostname is an internationalized domain name (IDN), this attribute now stores the A-label form ("xn--pythn-mua.org"), rather than the U-label form ("pythön.org").
python.library.ssl#ssl.SSLSocket.server_hostname
SSLSocket.server_side A boolean which is True for server-side sockets and False for client-side sockets. New in version 3.2.
python.library.ssl#ssl.SSLSocket.server_side
SSLSocket.session The SSLSession for this SSL connection. The session is available for client and server side sockets after the TLS handshake has been performed. For client sockets the session can be set before do_handshake() has been called to reuse a session. New in version 3.6.
python.library.ssl#ssl.SSLSocket.session
SSLSocket.session_reused New in version 3.6.
python.library.ssl#ssl.SSLSocket.session_reused
SSLSocket.shared_ciphers() Return the list of ciphers shared by the client during the handshake. Each entry of the returned list is a three-value tuple containing the name of the cipher, the version of the SSL protocol that defines its use, and the number of secret bits the cipher uses. shared_ciphers() returns None if no connection has been established or the socket is a client socket. New in version 3.5.
python.library.ssl#ssl.SSLSocket.shared_ciphers
SSLSocket.unwrap() Performs the SSL shutdown handshake, which removes the TLS layer from the underlying socket, and returns the underlying socket object. This can be used to go from encrypted operation over a connection to unencrypted. The returned socket should always be used for further communication with the other side of the connection, rather than the original socket.
python.library.ssl#ssl.SSLSocket.unwrap
SSLSocket.verify_client_post_handshake() Requests post-handshake authentication (PHA) from a TLS 1.3 client. PHA can only be initiated for a TLS 1.3 connection from a server-side socket, after the initial TLS handshake and with PHA enabled on both sides, see SSLContext.post_handshake_auth. The method does not perform a cert exchange immediately. The server-side sends a CertificateRequest during the next write event and expects the client to respond with a certificate on the next read event. If any precondition isn’t met (e.g. not TLS 1.3, PHA not enabled), an SSLError is raised. Note Only available with OpenSSL 1.1.1 and TLS 1.3 enabled. Without TLS 1.3 support, the method raises NotImplementedError. New in version 3.8.
python.library.ssl#ssl.SSLSocket.verify_client_post_handshake
SSLSocket.version() Return the actual SSL protocol version negotiated by the connection as a string, or None is no secure connection is established. As of this writing, possible return values include "SSLv2", "SSLv3", "TLSv1", "TLSv1.1" and "TLSv1.2". Recent OpenSSL versions may define more return values. New in version 3.5.
python.library.ssl#ssl.SSLSocket.version
SSLSocket.write(buf) Write buf to the SSL socket and return the number of bytes written. The buf argument must be an object supporting the buffer interface. Raise SSLWantReadError or SSLWantWriteError if the socket is non-blocking and the write would block. As at any time a re-negotiation is possible, a call to write() can also cause read operations. Changed in version 3.5: The socket timeout is no more reset each time bytes are received or sent. The socket timeout is now to maximum total duration to write buf. Deprecated since version 3.6: Use send() instead of write().
python.library.ssl#ssl.SSLSocket.write
exception ssl.SSLSyscallError A subclass of SSLError raised when a system error was encountered while trying to fulfill an operation on a SSL socket. Unfortunately, there is no easy way to inspect the original errno number. New in version 3.3.
python.library.ssl#ssl.SSLSyscallError
exception ssl.SSLWantReadError A subclass of SSLError raised by a non-blocking SSL socket when trying to read or write data, but more data needs to be received on the underlying TCP transport before the request can be fulfilled. New in version 3.3.
python.library.ssl#ssl.SSLWantReadError
exception ssl.SSLWantWriteError A subclass of SSLError raised by a non-blocking SSL socket when trying to read or write data, but more data needs to be sent on the underlying TCP transport before the request can be fulfilled. New in version 3.3.
python.library.ssl#ssl.SSLWantWriteError
exception ssl.SSLZeroReturnError A subclass of SSLError raised when trying to read or write and the SSL connection has been closed cleanly. Note that this doesn’t mean that the underlying transport (read TCP) has been closed. New in version 3.3.
python.library.ssl#ssl.SSLZeroReturnError
class ssl.TLSVersion enum.IntEnum collection of SSL and TLS versions for SSLContext.maximum_version and SSLContext.minimum_version. New in version 3.7.
python.library.ssl#ssl.TLSVersion
TLSVersion.MAXIMUM_SUPPORTED The minimum or maximum supported SSL or TLS version. These are magic constants. Their values don’t reflect the lowest and highest available TLS/SSL versions.
python.library.ssl#ssl.TLSVersion.MAXIMUM_SUPPORTED
TLSVersion.MINIMUM_SUPPORTED
python.library.ssl#ssl.TLSVersion.MINIMUM_SUPPORTED
TLSVersion.SSLv3
python.library.ssl#ssl.TLSVersion.SSLv3
TLSVersion.TLSv1
python.library.ssl#ssl.TLSVersion.TLSv1
TLSVersion.TLSv1_1
python.library.ssl#ssl.TLSVersion.TLSv1_1
TLSVersion.TLSv1_2
python.library.ssl#ssl.TLSVersion.TLSv1_2
TLSVersion.TLSv1_3 SSL 3.0 to TLS 1.3.
python.library.ssl#ssl.TLSVersion.TLSv1_3
class ssl.VerifyFlags enum.IntFlag collection of VERIFY_* constants. New in version 3.6.
python.library.ssl#ssl.VerifyFlags
class ssl.VerifyMode enum.IntEnum collection of CERT_* constants. New in version 3.6.
python.library.ssl#ssl.VerifyMode
ssl.VERIFY_CRL_CHECK_CHAIN Possible value for SSLContext.verify_flags. In this mode, CRLs of all certificates in the peer cert chain are checked. New in version 3.4.
python.library.ssl#ssl.VERIFY_CRL_CHECK_CHAIN
ssl.VERIFY_CRL_CHECK_LEAF Possible value for SSLContext.verify_flags. In this mode, only the peer cert is checked but none of the intermediate CA certificates. The mode requires a valid CRL that is signed by the peer cert’s issuer (its direct ancestor CA). If no proper CRL has been loaded with SSLContext.load_verify_locations, validation will fail. New in version 3.4.
python.library.ssl#ssl.VERIFY_CRL_CHECK_LEAF
ssl.VERIFY_DEFAULT Possible value for SSLContext.verify_flags. In this mode, certificate revocation lists (CRLs) are not checked. By default OpenSSL does neither require nor verify CRLs. New in version 3.4.
python.library.ssl#ssl.VERIFY_DEFAULT
ssl.VERIFY_X509_STRICT Possible value for SSLContext.verify_flags to disable workarounds for broken X.509 certificates. New in version 3.4.
python.library.ssl#ssl.VERIFY_X509_STRICT
ssl.VERIFY_X509_TRUSTED_FIRST Possible value for SSLContext.verify_flags. It instructs OpenSSL to prefer trusted certificates when building the trust chain to validate a certificate. This flag is enabled by default. New in version 3.4.4.
python.library.ssl#ssl.VERIFY_X509_TRUSTED_FIRST
ssl.wrap_socket(sock, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version=PROTOCOL_TLS, ca_certs=None, do_handshake_on_connect=True, suppress_ragged_eofs=True, ciphers=None) Takes an instance sock of socket.socket, and returns an instance of ssl.SSLSocket, a subtype of socket.socket, which wraps the underlying socket in an SSL context. sock must be a SOCK_STREAM socket; other socket types are unsupported. Internally, function creates a SSLContext with protocol ssl_version and SSLContext.options set to cert_reqs. If parameters keyfile, certfile, ca_certs or ciphers are set, then the values are passed to SSLContext.load_cert_chain(), SSLContext.load_verify_locations(), and SSLContext.set_ciphers(). The arguments server_side, do_handshake_on_connect, and suppress_ragged_eofs have the same meaning as SSLContext.wrap_socket(). Deprecated since version 3.7: Since Python 3.2 and 2.7.9, it is recommended to use the SSLContext.wrap_socket() instead of wrap_socket(). The top-level function is limited and creates an insecure client socket without server name indication or hostname matching.
python.library.ssl#ssl.wrap_socket
stat — Interpreting stat() results Source code: Lib/stat.py The stat module defines constants and functions for interpreting the results of os.stat(), os.fstat() and os.lstat() (if they exist). For complete details about the stat(), fstat() and lstat() calls, consult the documentation for your system. Changed in version 3.4: The stat module is backed by a C implementation. The stat module defines the following functions to test for specific file types: stat.S_ISDIR(mode) Return non-zero if the mode is from a directory. stat.S_ISCHR(mode) Return non-zero if the mode is from a character special device file. stat.S_ISBLK(mode) Return non-zero if the mode is from a block special device file. stat.S_ISREG(mode) Return non-zero if the mode is from a regular file. stat.S_ISFIFO(mode) Return non-zero if the mode is from a FIFO (named pipe). stat.S_ISLNK(mode) Return non-zero if the mode is from a symbolic link. stat.S_ISSOCK(mode) Return non-zero if the mode is from a socket. stat.S_ISDOOR(mode) Return non-zero if the mode is from a door. New in version 3.4. stat.S_ISPORT(mode) Return non-zero if the mode is from an event port. New in version 3.4. stat.S_ISWHT(mode) Return non-zero if the mode is from a whiteout. New in version 3.4. Two additional functions are defined for more general manipulation of the file’s mode: stat.S_IMODE(mode) Return the portion of the file’s mode that can be set by os.chmod()—that is, the file’s permission bits, plus the sticky bit, set-group-id, and set-user-id bits (on systems that support them). stat.S_IFMT(mode) Return the portion of the file’s mode that describes the file type (used by the S_IS*() functions above). Normally, you would use the os.path.is*() functions for testing the type of a file; the functions here are useful when you are doing multiple tests of the same file and wish to avoid the overhead of the stat() system call for each test. These are also useful when checking for information about a file that isn’t handled by os.path, like the tests for block and character devices. Example: import os, sys from stat import * def walktree(top, callback): '''recursively descend the directory tree rooted at top, calling the callback function for each regular file''' for f in os.listdir(top): pathname = os.path.join(top, f) mode = os.stat(pathname).st_mode if S_ISDIR(mode): # It's a directory, recurse into it walktree(pathname, callback) elif S_ISREG(mode): # It's a file, call the callback function callback(pathname) else: # Unknown file type, print a message print('Skipping %s' % pathname) def visitfile(file): print('visiting', file) if __name__ == '__main__': walktree(sys.argv[1], visitfile) An additional utility function is provided to convert a file’s mode in a human readable string: stat.filemode(mode) Convert a file’s mode to a string of the form ‘-rwxrwxrwx’. New in version 3.3. Changed in version 3.4: The function supports S_IFDOOR, S_IFPORT and S_IFWHT. All the variables below are simply symbolic indexes into the 10-tuple returned by os.stat(), os.fstat() or os.lstat(). stat.ST_MODE Inode protection mode. stat.ST_INO Inode number. stat.ST_DEV Device inode resides on. stat.ST_NLINK Number of links to the inode. stat.ST_UID User id of the owner. stat.ST_GID Group id of the owner. stat.ST_SIZE Size in bytes of a plain file; amount of data waiting on some special files. stat.ST_ATIME Time of last access. stat.ST_MTIME Time of last modification. stat.ST_CTIME The “ctime” as reported by the operating system. On some systems (like Unix) is the time of the last metadata change, and, on others (like Windows), is the creation time (see platform documentation for details). The interpretation of “file size” changes according to the file type. For plain files this is the size of the file in bytes. For FIFOs and sockets under most flavors of Unix (including Linux in particular), the “size” is the number of bytes waiting to be read at the time of the call to os.stat(), os.fstat(), or os.lstat(); this can sometimes be useful, especially for polling one of these special files after a non-blocking open. The meaning of the size field for other character and block devices varies more, depending on the implementation of the underlying system call. The variables below define the flags used in the ST_MODE field. Use of the functions above is more portable than use of the first set of flags: stat.S_IFSOCK Socket. stat.S_IFLNK Symbolic link. stat.S_IFREG Regular file. stat.S_IFBLK Block device. stat.S_IFDIR Directory. stat.S_IFCHR Character device. stat.S_IFIFO FIFO. stat.S_IFDOOR Door. New in version 3.4. stat.S_IFPORT Event port. New in version 3.4. stat.S_IFWHT Whiteout. New in version 3.4. Note S_IFDOOR, S_IFPORT or S_IFWHT are defined as 0 when the platform does not have support for the file types. The following flags can also be used in the mode argument of os.chmod(): stat.S_ISUID Set UID bit. stat.S_ISGID Set-group-ID bit. This bit has several special uses. For a directory it indicates that BSD semantics is to be used for that directory: files created there inherit their group ID from the directory, not from the effective group ID of the creating process, and directories created there will also get the S_ISGID bit set. For a file that does not have the group execution bit (S_IXGRP) set, the set-group-ID bit indicates mandatory file/record locking (see also S_ENFMT). stat.S_ISVTX Sticky bit. When this bit is set on a directory it means that a file in that directory can be renamed or deleted only by the owner of the file, by the owner of the directory, or by a privileged process. stat.S_IRWXU Mask for file owner permissions. stat.S_IRUSR Owner has read permission. stat.S_IWUSR Owner has write permission. stat.S_IXUSR Owner has execute permission. stat.S_IRWXG Mask for group permissions. stat.S_IRGRP Group has read permission. stat.S_IWGRP Group has write permission. stat.S_IXGRP Group has execute permission. stat.S_IRWXO Mask for permissions for others (not in group). stat.S_IROTH Others have read permission. stat.S_IWOTH Others have write permission. stat.S_IXOTH Others have execute permission. stat.S_ENFMT System V file locking enforcement. This flag is shared with S_ISGID: file/record locking is enforced on files that do not have the group execution bit (S_IXGRP) set. stat.S_IREAD Unix V7 synonym for S_IRUSR. stat.S_IWRITE Unix V7 synonym for S_IWUSR. stat.S_IEXEC Unix V7 synonym for S_IXUSR. The following flags can be used in the flags argument of os.chflags(): stat.UF_NODUMP Do not dump the file. stat.UF_IMMUTABLE The file may not be changed. stat.UF_APPEND The file may only be appended to. stat.UF_OPAQUE The directory is opaque when viewed through a union stack. stat.UF_NOUNLINK The file may not be renamed or deleted. stat.UF_COMPRESSED The file is stored compressed (Mac OS X 10.6+). stat.UF_HIDDEN The file should not be displayed in a GUI (Mac OS X 10.5+). stat.SF_ARCHIVED The file may be archived. stat.SF_IMMUTABLE The file may not be changed. stat.SF_APPEND The file may only be appended to. stat.SF_NOUNLINK The file may not be renamed or deleted. stat.SF_SNAPSHOT The file is a snapshot file. See the *BSD or Mac OS systems man page chflags(2) for more information. On Windows, the following file attribute constants are available for use when testing bits in the st_file_attributes member returned by os.stat(). See the Windows API documentation for more detail on the meaning of these constants. stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5. On Windows, the following constants are available for comparing against the st_reparse_tag member returned by os.lstat(). These are well-known constants, but are not an exhaustive list. stat.IO_REPARSE_TAG_SYMLINK stat.IO_REPARSE_TAG_MOUNT_POINT stat.IO_REPARSE_TAG_APPEXECLINK New in version 3.8.
python.library.stat
stat.filemode(mode) Convert a file’s mode to a string of the form ‘-rwxrwxrwx’. New in version 3.3. Changed in version 3.4: The function supports S_IFDOOR, S_IFPORT and S_IFWHT.
python.library.stat#stat.filemode
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_ARCHIVE
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_COMPRESSED
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_DEVICE
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_DIRECTORY
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_ENCRYPTED
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_HIDDEN
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_INTEGRITY_STREAM
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_NORMAL
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_NO_SCRUB_DATA
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_OFFLINE
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_READONLY
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_REPARSE_POINT
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_SPARSE_FILE
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_SYSTEM
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_TEMPORARY
stat.FILE_ATTRIBUTE_ARCHIVE stat.FILE_ATTRIBUTE_COMPRESSED stat.FILE_ATTRIBUTE_DEVICE stat.FILE_ATTRIBUTE_DIRECTORY stat.FILE_ATTRIBUTE_ENCRYPTED stat.FILE_ATTRIBUTE_HIDDEN stat.FILE_ATTRIBUTE_INTEGRITY_STREAM stat.FILE_ATTRIBUTE_NORMAL stat.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED stat.FILE_ATTRIBUTE_NO_SCRUB_DATA stat.FILE_ATTRIBUTE_OFFLINE stat.FILE_ATTRIBUTE_READONLY stat.FILE_ATTRIBUTE_REPARSE_POINT stat.FILE_ATTRIBUTE_SPARSE_FILE stat.FILE_ATTRIBUTE_SYSTEM stat.FILE_ATTRIBUTE_TEMPORARY stat.FILE_ATTRIBUTE_VIRTUAL New in version 3.5.
python.library.stat#stat.FILE_ATTRIBUTE_VIRTUAL
stat.IO_REPARSE_TAG_SYMLINK stat.IO_REPARSE_TAG_MOUNT_POINT stat.IO_REPARSE_TAG_APPEXECLINK New in version 3.8.
python.library.stat#stat.IO_REPARSE_TAG_APPEXECLINK
stat.IO_REPARSE_TAG_SYMLINK stat.IO_REPARSE_TAG_MOUNT_POINT stat.IO_REPARSE_TAG_APPEXECLINK New in version 3.8.
python.library.stat#stat.IO_REPARSE_TAG_MOUNT_POINT
stat.IO_REPARSE_TAG_SYMLINK stat.IO_REPARSE_TAG_MOUNT_POINT stat.IO_REPARSE_TAG_APPEXECLINK New in version 3.8.
python.library.stat#stat.IO_REPARSE_TAG_SYMLINK
stat.SF_APPEND The file may only be appended to.
python.library.stat#stat.SF_APPEND
stat.SF_ARCHIVED The file may be archived.
python.library.stat#stat.SF_ARCHIVED
stat.SF_IMMUTABLE The file may not be changed.
python.library.stat#stat.SF_IMMUTABLE
stat.SF_NOUNLINK The file may not be renamed or deleted.
python.library.stat#stat.SF_NOUNLINK
stat.SF_SNAPSHOT The file is a snapshot file.
python.library.stat#stat.SF_SNAPSHOT
stat.ST_ATIME Time of last access.
python.library.stat#stat.ST_ATIME
stat.ST_CTIME The “ctime” as reported by the operating system. On some systems (like Unix) is the time of the last metadata change, and, on others (like Windows), is the creation time (see platform documentation for details).
python.library.stat#stat.ST_CTIME
stat.ST_DEV Device inode resides on.
python.library.stat#stat.ST_DEV
stat.ST_GID Group id of the owner.
python.library.stat#stat.ST_GID
stat.ST_INO Inode number.
python.library.stat#stat.ST_INO
stat.ST_MODE Inode protection mode.
python.library.stat#stat.ST_MODE
stat.ST_MTIME Time of last modification.
python.library.stat#stat.ST_MTIME
stat.ST_NLINK Number of links to the inode.
python.library.stat#stat.ST_NLINK
stat.ST_SIZE Size in bytes of a plain file; amount of data waiting on some special files.
python.library.stat#stat.ST_SIZE
stat.ST_UID User id of the owner.
python.library.stat#stat.ST_UID
stat.S_ENFMT System V file locking enforcement. This flag is shared with S_ISGID: file/record locking is enforced on files that do not have the group execution bit (S_IXGRP) set.
python.library.stat#stat.S_ENFMT
stat.S_IEXEC Unix V7 synonym for S_IXUSR.
python.library.stat#stat.S_IEXEC
stat.S_IFBLK Block device.
python.library.stat#stat.S_IFBLK
stat.S_IFCHR Character device.
python.library.stat#stat.S_IFCHR
stat.S_IFDIR Directory.
python.library.stat#stat.S_IFDIR
stat.S_IFDOOR Door. New in version 3.4.
python.library.stat#stat.S_IFDOOR
stat.S_IFIFO FIFO.
python.library.stat#stat.S_IFIFO
stat.S_IFLNK Symbolic link.
python.library.stat#stat.S_IFLNK
stat.S_IFMT(mode) Return the portion of the file’s mode that describes the file type (used by the S_IS*() functions above).
python.library.stat#stat.S_IFMT
stat.S_IFPORT Event port. New in version 3.4.
python.library.stat#stat.S_IFPORT
stat.S_IFREG Regular file.
python.library.stat#stat.S_IFREG
stat.S_IFSOCK Socket.
python.library.stat#stat.S_IFSOCK
stat.S_IFWHT Whiteout. New in version 3.4.
python.library.stat#stat.S_IFWHT
stat.S_IMODE(mode) Return the portion of the file’s mode that can be set by os.chmod()—that is, the file’s permission bits, plus the sticky bit, set-group-id, and set-user-id bits (on systems that support them).
python.library.stat#stat.S_IMODE
stat.S_IREAD Unix V7 synonym for S_IRUSR.
python.library.stat#stat.S_IREAD
stat.S_IRGRP Group has read permission.
python.library.stat#stat.S_IRGRP
stat.S_IROTH Others have read permission.
python.library.stat#stat.S_IROTH
stat.S_IRUSR Owner has read permission.
python.library.stat#stat.S_IRUSR
stat.S_IRWXG Mask for group permissions.
python.library.stat#stat.S_IRWXG
stat.S_IRWXO Mask for permissions for others (not in group).
python.library.stat#stat.S_IRWXO
stat.S_IRWXU Mask for file owner permissions.
python.library.stat#stat.S_IRWXU
stat.S_ISBLK(mode) Return non-zero if the mode is from a block special device file.
python.library.stat#stat.S_ISBLK
stat.S_ISCHR(mode) Return non-zero if the mode is from a character special device file.
python.library.stat#stat.S_ISCHR
stat.S_ISDIR(mode) Return non-zero if the mode is from a directory.
python.library.stat#stat.S_ISDIR
stat.S_ISDOOR(mode) Return non-zero if the mode is from a door. New in version 3.4.
python.library.stat#stat.S_ISDOOR
stat.S_ISFIFO(mode) Return non-zero if the mode is from a FIFO (named pipe).
python.library.stat#stat.S_ISFIFO