doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
class http.server.CGIHTTPRequestHandler(request, client_address, server) This class is used to serve either files or output of CGI scripts from the current directory and below. Note that mapping HTTP hierarchic structure to local directory structure is exactly as in SimpleHTTPRequestHandler. Note CGI scripts run by ...
python.library.http.server#http.server.CGIHTTPRequestHandler
cgi_directories This defaults to ['/cgi-bin', '/htbin'] and describes directories to treat as containing CGI scripts.
python.library.http.server#http.server.CGIHTTPRequestHandler.cgi_directories
do_POST() This method serves the 'POST' request type, only allowed for CGI scripts. Error 501, “Can only POST to CGI scripts”, is output when trying to POST to a non-CGI url.
python.library.http.server#http.server.CGIHTTPRequestHandler.do_POST
class http.server.HTTPServer(server_address, RequestHandlerClass) This class builds on the TCPServer class by storing the server address as instance variables named server_name and server_port. The server is accessible by the handler, typically through the handler’s server instance variable.
python.library.http.server#http.server.HTTPServer
class http.server.SimpleHTTPRequestHandler(request, client_address, server, directory=None) This class serves files from the current directory and below, directly mapping the directory structure to HTTP requests. A lot of the work, such as parsing the request, is done by the base class BaseHTTPRequestHandler. This cl...
python.library.http.server#http.server.SimpleHTTPRequestHandler
directory If not specified, the directory to serve is the current working directory. Changed in version 3.9: Accepts a path-like object.
python.library.http.server#http.server.SimpleHTTPRequestHandler.directory
do_GET() The request is mapped to a local file by interpreting the request as a path relative to the current working directory. If the request was mapped to a directory, the directory is checked for a file named index.html or index.htm (in that order). If found, the file’s contents are returned; otherwise a directory...
python.library.http.server#http.server.SimpleHTTPRequestHandler.do_GET
do_HEAD() This method serves the 'HEAD' request type: it sends the headers it would send for the equivalent GET request. See the do_GET() method for a more complete explanation of the possible headers.
python.library.http.server#http.server.SimpleHTTPRequestHandler.do_HEAD
extensions_map A dictionary mapping suffixes into MIME types, contains custom overrides for the default system mappings. The mapping is used case-insensitively, and so should contain only lower-cased keys. Changed in version 3.9: This dictionary is no longer filled with the default system mappings, but only contains...
python.library.http.server#http.server.SimpleHTTPRequestHandler.extensions_map
server_version This will be "SimpleHTTP/" + __version__, where __version__ is defined at the module level.
python.library.http.server#http.server.SimpleHTTPRequestHandler.server_version
class http.server.ThreadingHTTPServer(server_address, RequestHandlerClass) This class is identical to HTTPServer but uses threads to handle requests by using the ThreadingMixIn. This is useful to handle web browsers pre-opening sockets, on which HTTPServer would wait indefinitely. New in version 3.7.
python.library.http.server#http.server.ThreadingHTTPServer
id(object) Return the “identity” of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same id() value. CPython implementation detail: This is the address of the object in memory. Raises an auditing...
python.library.functions#id
IDLE Source code: Lib/idlelib/ IDLE is Python’s Integrated Development and Learning Environment. IDLE has the following features: coded in 100% pure Python, using the tkinter GUI toolkit cross-platform: works mostly the same on Windows, Unix, and macOS Python shell window (interactive interpreter) with colorizing of c...
python.library.idle
imaplib — IMAP4 protocol client Source code: Lib/imaplib.py This module defines three classes, IMAP4, IMAP4_SSL and IMAP4_stream, which encapsulate a connection to an IMAP4 server and implement a large subset of the IMAP4rev1 client protocol as defined in RFC 2060. It is backward compatible with IMAP4 (RFC 1730) server...
python.library.imaplib
class imaplib.IMAP4(host='', port=IMAP4_PORT, timeout=None) This class implements the actual IMAP4 protocol. The connection is created and protocol version (IMAP4 or IMAP4rev1) is determined when the instance is initialized. If host is not specified, '' (the local host) is used. If port is omitted, the standard IMAP4...
python.library.imaplib#imaplib.IMAP4
exception IMAP4.abort IMAP4 server errors cause this exception to be raised. This is a sub-class of IMAP4.error. Note that closing the instance and instantiating a new one will usually allow recovery from this exception.
python.library.imaplib#imaplib.IMAP4.abort
IMAP4.append(mailbox, flags, date_time, message) Append message to named mailbox.
python.library.imaplib#imaplib.IMAP4.append
IMAP4.authenticate(mechanism, authobject) Authenticate command — requires response processing. mechanism specifies which authentication mechanism is to be used - it should appear in the instance variable capabilities in the form AUTH=mechanism. authobject must be a callable object: data = authobject(response) It wil...
python.library.imaplib#imaplib.IMAP4.authenticate
IMAP4.check() Checkpoint mailbox on server.
python.library.imaplib#imaplib.IMAP4.check
IMAP4.close() Close currently selected mailbox. Deleted messages are removed from writable mailbox. This is the recommended command before LOGOUT.
python.library.imaplib#imaplib.IMAP4.close
IMAP4.copy(message_set, new_mailbox) Copy message_set messages onto end of new_mailbox.
python.library.imaplib#imaplib.IMAP4.copy
IMAP4.create(mailbox) Create new mailbox named mailbox.
python.library.imaplib#imaplib.IMAP4.create
IMAP4.debug Integer value to control debugging output. The initialize value is taken from the module variable Debug. Values greater than three trace each command.
python.library.imaplib#imaplib.IMAP4.debug
IMAP4.delete(mailbox) Delete old mailbox named mailbox.
python.library.imaplib#imaplib.IMAP4.delete
IMAP4.deleteacl(mailbox, who) Delete the ACLs (remove any rights) set for who on mailbox.
python.library.imaplib#imaplib.IMAP4.deleteacl
IMAP4.enable(capability) Enable capability (see RFC 5161). Most capabilities do not need to be enabled. Currently only the UTF8=ACCEPT capability is supported (see RFC 6855). New in version 3.5: The enable() method itself, and RFC 6855 support.
python.library.imaplib#imaplib.IMAP4.enable
exception IMAP4.error Exception raised on any errors. The reason for the exception is passed to the constructor as a string.
python.library.imaplib#imaplib.IMAP4.error
IMAP4.expunge() Permanently remove deleted items from selected mailbox. Generates an EXPUNGE response for each deleted message. Returned data contains a list of EXPUNGE message numbers in order received.
python.library.imaplib#imaplib.IMAP4.expunge
IMAP4.fetch(message_set, message_parts) Fetch (parts of) messages. message_parts should be a string of message part names enclosed within parentheses, eg: "(UID BODY[TEXT])". Returned data are tuples of message part envelope and data.
python.library.imaplib#imaplib.IMAP4.fetch
IMAP4.getacl(mailbox) Get the ACLs for mailbox. The method is non-standard, but is supported by the Cyrus server.
python.library.imaplib#imaplib.IMAP4.getacl
IMAP4.getannotation(mailbox, entry, attribute) Retrieve the specified ANNOTATIONs for mailbox. The method is non-standard, but is supported by the Cyrus server.
python.library.imaplib#imaplib.IMAP4.getannotation
IMAP4.getquota(root) Get the quota root’s resource usage and limits. This method is part of the IMAP4 QUOTA extension defined in rfc2087.
python.library.imaplib#imaplib.IMAP4.getquota
IMAP4.getquotaroot(mailbox) Get the list of quota roots for the named mailbox. This method is part of the IMAP4 QUOTA extension defined in rfc2087.
python.library.imaplib#imaplib.IMAP4.getquotaroot
IMAP4.list([directory[, pattern]]) List mailbox names in directory matching pattern. directory defaults to the top-level mail folder, and pattern defaults to match anything. Returned data contains a list of LIST responses.
python.library.imaplib#imaplib.IMAP4.list
IMAP4.login(user, password) Identify the client using a plaintext password. The password will be quoted.
python.library.imaplib#imaplib.IMAP4.login
IMAP4.login_cram_md5(user, password) Force use of CRAM-MD5 authentication when identifying the client to protect the password. Will only work if the server CAPABILITY response includes the phrase AUTH=CRAM-MD5.
python.library.imaplib#imaplib.IMAP4.login_cram_md5
IMAP4.logout() Shutdown connection to server. Returns server BYE response. Changed in version 3.8: The method no longer ignores silently arbitrary exceptions.
python.library.imaplib#imaplib.IMAP4.logout
IMAP4.lsub(directory='""', pattern='*') List subscribed mailbox names in directory matching pattern. directory defaults to the top level directory and pattern defaults to match any mailbox. Returned data are tuples of message part envelope and data.
python.library.imaplib#imaplib.IMAP4.lsub
IMAP4.myrights(mailbox) Show my ACLs for a mailbox (i.e. the rights that I have on mailbox).
python.library.imaplib#imaplib.IMAP4.myrights
IMAP4.namespace() Returns IMAP namespaces as defined in RFC 2342.
python.library.imaplib#imaplib.IMAP4.namespace
IMAP4.noop() Send NOOP to server.
python.library.imaplib#imaplib.IMAP4.noop
IMAP4.open(host, port, timeout=None) Opens socket to port at host. The optional timeout parameter specifies a timeout in seconds for the connection attempt. If timeout is not given or is None, the global default socket timeout is used. Also note that if the timeout parameter is set to be zero, it will raise a ValueEr...
python.library.imaplib#imaplib.IMAP4.open
IMAP4.partial(message_num, message_part, start, length) Fetch truncated part of a message. Returned data is a tuple of message part envelope and data.
python.library.imaplib#imaplib.IMAP4.partial
IMAP4.PROTOCOL_VERSION The most recent supported protocol in the CAPABILITY response from the server.
python.library.imaplib#imaplib.IMAP4.PROTOCOL_VERSION
IMAP4.proxyauth(user) Assume authentication as user. Allows an authorised administrator to proxy into any user’s mailbox.
python.library.imaplib#imaplib.IMAP4.proxyauth
IMAP4.read(size) Reads size bytes from the remote server. You may override this method.
python.library.imaplib#imaplib.IMAP4.read
IMAP4.readline() Reads one line from the remote server. You may override this method.
python.library.imaplib#imaplib.IMAP4.readline
exception IMAP4.readonly This exception is raised when a writable mailbox has its status changed by the server. This is a sub-class of IMAP4.error. Some other client now has write permission, and the mailbox will need to be re-opened to re-obtain write permission.
python.library.imaplib#imaplib.IMAP4.readonly
IMAP4.recent() Prompt server for an update. Returned data is None if no new messages, else value of RECENT response.
python.library.imaplib#imaplib.IMAP4.recent
IMAP4.rename(oldmailbox, newmailbox) Rename mailbox named oldmailbox to newmailbox.
python.library.imaplib#imaplib.IMAP4.rename
IMAP4.response(code) Return data for response code if received, or None. Returns the given code, instead of the usual type.
python.library.imaplib#imaplib.IMAP4.response
IMAP4.search(charset, criterion[, ...]) Search mailbox for matching messages. charset may be None, in which case no CHARSET will be specified in the request to the server. The IMAP protocol requires that at least one criterion be specified; an exception will be raised when the server returns an error. charset must be...
python.library.imaplib#imaplib.IMAP4.search
IMAP4.select(mailbox='INBOX', readonly=False) Select a mailbox. Returned data is the count of messages in mailbox (EXISTS response). The default mailbox is 'INBOX'. If the readonly flag is set, modifications to the mailbox are not allowed.
python.library.imaplib#imaplib.IMAP4.select
IMAP4.send(data) Sends data to the remote server. You may override this method. Raises an auditing event imaplib.send with arguments self, data.
python.library.imaplib#imaplib.IMAP4.send
IMAP4.setacl(mailbox, who, what) Set an ACL for mailbox. The method is non-standard, but is supported by the Cyrus server.
python.library.imaplib#imaplib.IMAP4.setacl
IMAP4.setannotation(mailbox, entry, attribute[, ...]) Set ANNOTATIONs for mailbox. The method is non-standard, but is supported by the Cyrus server.
python.library.imaplib#imaplib.IMAP4.setannotation
IMAP4.setquota(root, limits) Set the quota root’s resource limits. This method is part of the IMAP4 QUOTA extension defined in rfc2087.
python.library.imaplib#imaplib.IMAP4.setquota
IMAP4.shutdown() Close connection established in open. This method is implicitly called by IMAP4.logout(). You may override this method.
python.library.imaplib#imaplib.IMAP4.shutdown
IMAP4.socket() Returns socket instance used to connect to server.
python.library.imaplib#imaplib.IMAP4.socket
IMAP4.sort(sort_criteria, charset, search_criterion[, ...]) The sort command is a variant of search with sorting semantics for the results. Returned data contains a space separated list of matching message numbers. Sort has two arguments before the search_criterion argument(s); a parenthesized list of sort_criteria, ...
python.library.imaplib#imaplib.IMAP4.sort
IMAP4.starttls(ssl_context=None) Send a STARTTLS command. The ssl_context argument is optional and should be a ssl.SSLContext object. This will enable encryption on the IMAP connection. Please read Security considerations for best practices. New in version 3.2. Changed in version 3.4: The method now supports hostn...
python.library.imaplib#imaplib.IMAP4.starttls
IMAP4.status(mailbox, names) Request named status conditions for mailbox.
python.library.imaplib#imaplib.IMAP4.status
IMAP4.store(message_set, command, flag_list) Alters flag dispositions for messages in mailbox. command is specified by section 6.4.6 of RFC 2060 as being one of “FLAGS”, “+FLAGS”, or “-FLAGS”, optionally with a suffix of “.SILENT”. For example, to set the delete flag on all messages: typ, data = M.search(None, 'ALL')...
python.library.imaplib#imaplib.IMAP4.store
IMAP4.subscribe(mailbox) Subscribe to new mailbox.
python.library.imaplib#imaplib.IMAP4.subscribe
IMAP4.thread(threading_algorithm, charset, search_criterion[, ...]) The thread command is a variant of search with threading semantics for the results. Returned data contains a space separated list of thread members. Thread members consist of zero or more messages numbers, delimited by spaces, indicating successive p...
python.library.imaplib#imaplib.IMAP4.thread
IMAP4.uid(command, arg[, ...]) Execute command args with messages identified by UID, rather than message number. Returns response appropriate to command. At least one argument must be supplied; if none are provided, the server will return an error and an exception will be raised.
python.library.imaplib#imaplib.IMAP4.uid
IMAP4.unselect() imaplib.IMAP4.unselect() frees server’s resources associated with the selected mailbox and returns the server to the authenticated state. This command performs the same actions as imaplib.IMAP4.close(), except that no messages are permanently removed from the currently selected mailbox. New in versi...
python.library.imaplib#imaplib.IMAP4.unselect
IMAP4.unsubscribe(mailbox) Unsubscribe from old mailbox.
python.library.imaplib#imaplib.IMAP4.unsubscribe
IMAP4.utf8_enabled Boolean value that is normally False, but is set to True if an enable() command is successfully issued for the UTF8=ACCEPT capability. New in version 3.5.
python.library.imaplib#imaplib.IMAP4.utf8_enabled
IMAP4.xatom(name[, ...]) Allow simple extension commands notified by server in CAPABILITY response.
python.library.imaplib#imaplib.IMAP4.xatom
class imaplib.IMAP4_SSL(host='', port=IMAP4_SSL_PORT, keyfile=None, certfile=None, ssl_context=None, timeout=None) This is a subclass derived from IMAP4 that connects over an SSL encrypted socket (to use this class you need a socket module that was compiled with SSL support). If host is not specified, '' (the local h...
python.library.imaplib#imaplib.IMAP4_SSL
class imaplib.IMAP4_stream(command) This is a subclass derived from IMAP4 that connects to the stdin/stdout file descriptors created by passing command to subprocess.Popen().
python.library.imaplib#imaplib.IMAP4_stream
imaplib.Int2AP(num) Converts an integer into a bytes representation using characters from the set [A .. P].
python.library.imaplib#imaplib.Int2AP
imaplib.Internaldate2tuple(datestr) Parse an IMAP4 INTERNALDATE string and return corresponding local time. The return value is a time.struct_time tuple or None if the string has wrong format.
python.library.imaplib#imaplib.Internaldate2tuple
imaplib.ParseFlags(flagstr) Converts an IMAP4 FLAGS response to a tuple of individual flags.
python.library.imaplib#imaplib.ParseFlags
imaplib.Time2Internaldate(date_time) Convert date_time to an IMAP4 INTERNALDATE representation. The return value is a string in the form: "DD-Mmm-YYYY HH:MM:SS +HHMM" (including double-quotes). The date_time argument can be a number (int or float) representing seconds since epoch (as returned by time.time()), a 9-tup...
python.library.imaplib#imaplib.Time2Internaldate
imghdr — Determine the type of an image Source code: Lib/imghdr.py The imghdr module determines the type of image contained in a file or byte stream. The imghdr module defines the following function: imghdr.what(filename, h=None) Tests the image data contained in the file named by filename, and returns a string des...
python.library.imghdr
imghdr.tests A list of functions performing the individual tests. Each function takes two arguments: the byte-stream and an open file-like object. When what() is called with a byte-stream, the file-like object will be None. The test function should return a string describing the image type if the test succeeded, or N...
python.library.imghdr#imghdr.tests
imghdr.what(filename, h=None) Tests the image data contained in the file named by filename, and returns a string describing the image type. If optional h is provided, the filename is ignored and h is assumed to contain the byte stream to test. Changed in version 3.6: Accepts a path-like object.
python.library.imghdr#imghdr.what
exception ImportError Raised when the import statement has troubles trying to load a module. Also raised when the “from list” in from ... import has a name that cannot be found. The name and path attributes can be set using keyword-only arguments to the constructor. When set they represent the name of the module that...
python.library.exceptions#ImportError
importlib — The implementation of import New in version 3.1. Source code: Lib/importlib/__init__.py Introduction The purpose of the importlib package is two-fold. One is to provide the implementation of the import statement (and thus, by extension, the __import__() function) in Python source code. This provides an im...
python.library.importlib
class importlib.abc.ExecutionLoader An abstract base class which inherits from InspectLoader that, when implemented, helps a module to be executed as a script. The ABC represents an optional PEP 302 protocol. abstractmethod get_filename(fullname) An abstract method that is to return the value of __file__ for the ...
python.library.importlib#importlib.abc.ExecutionLoader
abstractmethod get_filename(fullname) An abstract method that is to return the value of __file__ for the specified module. If no path is available, ImportError is raised. If source code is available, then the method should return the path to the source file, regardless of whether a bytecode was used to load the modul...
python.library.importlib#importlib.abc.ExecutionLoader.get_filename
class importlib.abc.FileLoader(fullname, path) An abstract base class which inherits from ResourceLoader and ExecutionLoader, providing concrete implementations of ResourceLoader.get_data() and ExecutionLoader.get_filename(). The fullname argument is a fully resolved name of the module the loader is to handle. The pa...
python.library.importlib#importlib.abc.FileLoader
abstractmethod get_data(path) Reads path as a binary file and returns the bytes from it.
python.library.importlib#importlib.abc.FileLoader.get_data
abstractmethod get_filename(fullname) Returns path.
python.library.importlib#importlib.abc.FileLoader.get_filename
load_module(fullname) Calls super’s load_module(). Deprecated since version 3.4: Use Loader.exec_module() instead.
python.library.importlib#importlib.abc.FileLoader.load_module
name The name of the module the loader can handle.
python.library.importlib#importlib.abc.FileLoader.name
path Path to the file of the module.
python.library.importlib#importlib.abc.FileLoader.path
class importlib.abc.Finder An abstract base class representing a finder. Deprecated since version 3.3: Use MetaPathFinder or PathEntryFinder instead. abstractmethod find_module(fullname, path=None) An abstract method for finding a loader for the specified module. Originally specified in PEP 302, this method was...
python.library.importlib#importlib.abc.Finder
abstractmethod find_module(fullname, path=None) An abstract method for finding a loader for the specified module. Originally specified in PEP 302, this method was meant for use in sys.meta_path and in the path-based import subsystem. Changed in version 3.4: Returns None when called instead of raising NotImplementedE...
python.library.importlib#importlib.abc.Finder.find_module
class importlib.abc.InspectLoader An abstract base class for a loader which implements the optional PEP 302 protocol for loaders that inspect modules. get_code(fullname) Return the code object for a module, or None if the module does not have a code object (as would be the case, for example, for a built-in module...
python.library.importlib#importlib.abc.InspectLoader
exec_module(module) Implementation of Loader.exec_module(). New in version 3.4.
python.library.importlib#importlib.abc.InspectLoader.exec_module
get_code(fullname) Return the code object for a module, or None if the module does not have a code object (as would be the case, for example, for a built-in module). Raise an ImportError if loader cannot find the requested module. Note While the method has a default implementation, it is suggested that it be overrid...
python.library.importlib#importlib.abc.InspectLoader.get_code
abstractmethod get_source(fullname) An abstract method to return the source of a module. It is returned as a text string using universal newlines, translating all recognized line separators into '\n' characters. Returns None if no source is available (e.g. a built-in module). Raises ImportError if the loader cannot f...
python.library.importlib#importlib.abc.InspectLoader.get_source
is_package(fullname) An abstract method to return a true value if the module is a package, a false value otherwise. ImportError is raised if the loader cannot find the module. Changed in version 3.4: Raises ImportError instead of NotImplementedError.
python.library.importlib#importlib.abc.InspectLoader.is_package
load_module(fullname) Implementation of Loader.load_module(). Deprecated since version 3.4: use exec_module() instead.
python.library.importlib#importlib.abc.InspectLoader.load_module
static source_to_code(data, path='<string>') Create a code object from Python source. The data argument can be whatever the compile() function supports (i.e. string or bytes). The path argument should be the “path” to where the source code originated from, which can be an abstract concept (e.g. location in a zip file...
python.library.importlib#importlib.abc.InspectLoader.source_to_code
class importlib.abc.Loader An abstract base class for a loader. See PEP 302 for the exact definition for a loader. Loaders that wish to support resource reading should implement a get_resource_reader(fullname) method as specified by importlib.abc.ResourceReader. Changed in version 3.7: Introduced the optional get_re...
python.library.importlib#importlib.abc.Loader
create_module(spec) A method that returns the module object to use when importing a module. This method may return None, indicating that default module creation semantics should take place. New in version 3.4. Changed in version 3.5: Starting in Python 3.6, this method will not be optional when exec_module() is de...
python.library.importlib#importlib.abc.Loader.create_module