imaplib.IMAP4

class imaplib.IMAP4(host='', port=IMAP4_PORT) 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 port (143) is used. The IMAP4 class supports the with statement. When used like this, the IMAP4 LOGOUT command is issued automatically when the with statement exits. E.g.: >>> from i

id()

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.

http.server.SimpleHTTPRequestHandler.extensions_map

extensions_map A dictionary mapping suffixes into MIME types. The default is signified by an empty string, and is considered to be application/octet-stream. The mapping is used case-insensitively, and so should contain only lower-cased keys.

http.server.SimpleHTTPRequestHandler

class http.server.SimpleHTTPRequestHandler(request, client_address, server) 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 class implements the do_GET() and do_HEAD() functions. The following are defined as class-level attributes of SimpleHTTPRequestHandler: server_version This will be "SimpleHTTP/" + __version__,

http.server.SimpleHTTPRequestHandler.server_version

server_version This will be "SimpleHTTP/" + __version__, where __version__ is defined at the module level.

http.server.SimpleHTTPRequestHandler.do_HEAD()

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.

http.server.SimpleHTTPRequestHandler.do_GET()

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 listing is generated by calling the list_directory() method. This method uses os.listdir() to scan the directory, and returns a 404 error response if the listdir() fails. If the

http.server.CGIHTTPRequestHandler

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 the CGIHTTPRequestHandler class cannot execute redirects (HTTP code 302), because code 200 (script output follows) is sent prior to execution of the CGI script. This pre-empts th

http.server.BaseHTTPRequestHandler.version_string()

version_string() Returns the server software’s version string. This is a combination of the server_version and sys_version attributes.

http.server.CGIHTTPRequestHandler.do_POST()

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.