doc_content
stringlengths
1
386k
doc_id
stringlengths
5
188
HMAC.name The canonical name of this HMAC, always lowercase, e.g. hmac-md5. New in version 3.4.
python.library.hmac#hmac.HMAC.name
HMAC.update(msg) Update the hmac object with msg. Repeated calls are equivalent to a single call with the concatenation of all the arguments: m.update(a); m.update(b) is equivalent to m.update(a + b). Changed in version 3.4: Parameter msg can be of any type supported by hashlib.
python.library.hmac#hmac.HMAC.update
hmac.new(key, msg=None, digestmod='') Return a new hmac object. key is a bytes or bytearray object giving the secret key. If msg is present, the method call update(msg) is made. digestmod is the digest name, digest constructor or module for the HMAC object to use. It may be any name suitable to hashlib.new(). Despite...
python.library.hmac#hmac.new
html — HyperText Markup Language support Source code: Lib/html/__init__.py This module defines utilities to manipulate HTML. html.escape(s, quote=True) Convert the characters &, < and > in string s to HTML-safe sequences. Use this if you need to display text that might contain such characters in HTML. If the option...
python.library.html
html.entities — Definitions of HTML general entities Source code: Lib/html/entities.py This module defines four dictionaries, html5, name2codepoint, codepoint2name, and entitydefs. html.entities.html5 A dictionary that maps HTML5 named character references 1 to the equivalent Unicode character(s), e.g. html5['gt;']...
python.library.html.entities
html.entities.codepoint2name A dictionary that maps Unicode code points to HTML entity names.
python.library.html.entities#html.entities.codepoint2name
html.entities.entitydefs A dictionary mapping XHTML 1.0 entity definitions to their replacement text in ISO Latin-1.
python.library.html.entities#html.entities.entitydefs
html.entities.html5 A dictionary that maps HTML5 named character references 1 to the equivalent Unicode character(s), e.g. html5['gt;'] == '>'. Note that the trailing semicolon is included in the name (e.g. 'gt;'), however some of the names are accepted by the standard even without the semicolon: in this case the nam...
python.library.html.entities#html.entities.html5
html.entities.name2codepoint A dictionary that maps HTML entity names to the Unicode code points.
python.library.html.entities#html.entities.name2codepoint
html.escape(s, quote=True) Convert the characters &, < and > in string s to HTML-safe sequences. Use this if you need to display text that might contain such characters in HTML. If the optional flag quote is true, the characters (") and (') are also translated; this helps for inclusion in an HTML attribute value deli...
python.library.html#html.escape
html.parser — Simple HTML and XHTML parser Source code: Lib/html/parser.py This module defines a class HTMLParser which serves as the basis for parsing text files formatted in HTML (HyperText Mark-up Language) and XHTML. class html.parser.HTMLParser(*, convert_charrefs=True) Create a parser instance able to parse i...
python.library.html.parser
class html.parser.HTMLParser(*, convert_charrefs=True) Create a parser instance able to parse invalid markup. If convert_charrefs is True (the default), all character references (except the ones in script/style elements) are automatically converted to the corresponding Unicode characters. An HTMLParser instance is fe...
python.library.html.parser#html.parser.HTMLParser
HTMLParser.close() Force processing of all buffered data as if it were followed by an end-of-file mark. This method may be redefined by a derived class to define additional processing at the end of the input, but the redefined version should always call the HTMLParser base class method close().
python.library.html.parser#html.parser.HTMLParser.close
HTMLParser.feed(data) Feed some text to the parser. It is processed insofar as it consists of complete elements; incomplete data is buffered until more data is fed or close() is called. data must be str.
python.library.html.parser#html.parser.HTMLParser.feed
HTMLParser.getpos() Return current line number and offset.
python.library.html.parser#html.parser.HTMLParser.getpos
HTMLParser.get_starttag_text() Return the text of the most recently opened start tag. This should not normally be needed for structured processing, but may be useful in dealing with HTML “as deployed” or for re-generating input with minimal changes (whitespace between attributes can be preserved, etc.).
python.library.html.parser#html.parser.HTMLParser.get_starttag_text
HTMLParser.handle_charref(name) This method is called to process decimal and hexadecimal numeric character references of the form &#NNN; and &#xNNN;. For example, the decimal equivalent for &gt; is &#62;, whereas the hexadecimal is &#x3E;; in this case the method will receive '62' or 'x3E'. This method is never calle...
python.library.html.parser#html.parser.HTMLParser.handle_charref
HTMLParser.handle_comment(data) This method is called when a comment is encountered (e.g. <!--comment-->). For example, the comment <!-- comment --> will cause this method to be called with the argument ' comment '. The content of Internet Explorer conditional comments (condcoms) will also be sent to this method, so,...
python.library.html.parser#html.parser.HTMLParser.handle_comment
HTMLParser.handle_data(data) This method is called to process arbitrary data (e.g. text nodes and the content of <script>...</script> and <style>...</style>).
python.library.html.parser#html.parser.HTMLParser.handle_data
HTMLParser.handle_decl(decl) This method is called to handle an HTML doctype declaration (e.g. <!DOCTYPE html>). The decl parameter will be the entire contents of the declaration inside the <!...> markup (e.g. 'DOCTYPE html').
python.library.html.parser#html.parser.HTMLParser.handle_decl
HTMLParser.handle_endtag(tag) This method is called to handle the end tag of an element (e.g. </div>). The tag argument is the name of the tag converted to lower case.
python.library.html.parser#html.parser.HTMLParser.handle_endtag
HTMLParser.handle_entityref(name) This method is called to process a named character reference of the form &name; (e.g. &gt;), where name is a general entity reference (e.g. 'gt'). This method is never called if convert_charrefs is True.
python.library.html.parser#html.parser.HTMLParser.handle_entityref
HTMLParser.handle_pi(data) Method called when a processing instruction is encountered. The data parameter will contain the entire processing instruction. For example, for the processing instruction <?proc color='red'>, this method would be called as handle_pi("proc color='red'"). It is intended to be overridden by a ...
python.library.html.parser#html.parser.HTMLParser.handle_pi
HTMLParser.handle_startendtag(tag, attrs) Similar to handle_starttag(), but called when the parser encounters an XHTML-style empty tag (<img ... />). This method may be overridden by subclasses which require this particular lexical information; the default implementation simply calls handle_starttag() and handle_endt...
python.library.html.parser#html.parser.HTMLParser.handle_startendtag
HTMLParser.handle_starttag(tag, attrs) This method is called to handle the start of a tag (e.g. <div id="main">). The tag argument is the name of the tag converted to lower case. The attrs argument is a list of (name, value) pairs containing the attributes found inside the tag’s <> brackets. The name will be translat...
python.library.html.parser#html.parser.HTMLParser.handle_starttag
HTMLParser.reset() Reset the instance. Loses all unprocessed data. This is called implicitly at instantiation time.
python.library.html.parser#html.parser.HTMLParser.reset
HTMLParser.unknown_decl(data) This method is called when an unrecognized declaration is read by the parser. The data parameter will be the entire contents of the declaration inside the <![...]> markup. It is sometimes useful to be overridden by a derived class. The base class implementation does nothing.
python.library.html.parser#html.parser.HTMLParser.unknown_decl
html.unescape(s) Convert all named and numeric character references (e.g. &gt;, &#62;, &#x3e;) in the string s to the corresponding Unicode characters. This function uses the rules defined by the HTML 5 standard for both valid and invalid character references, and the list of HTML 5 named character references. New i...
python.library.html#html.unescape
http — HTTP modules Source code: Lib/http/__init__.py http is a package that collects several modules for working with the HyperText Transfer Protocol: http.client is a low-level HTTP protocol client; for high-level URL opening use urllib.request http.server contains basic HTTP server classes based on socketserver ...
python.library.http
http.client — HTTP protocol client Source code: Lib/http/client.py This module defines classes which implement the client side of the HTTP and HTTPS protocols. It is normally not used directly — the module urllib.request uses it to handle URLs that use HTTP and HTTPS. See also The Requests package is recommended for a...
python.library.http.client
exception http.client.BadStatusLine A subclass of HTTPException. Raised if a server responds with a HTTP status code that we don’t understand.
python.library.http.client#http.client.BadStatusLine
exception http.client.CannotSendHeader A subclass of ImproperConnectionState.
python.library.http.client#http.client.CannotSendHeader
exception http.client.CannotSendRequest A subclass of ImproperConnectionState.
python.library.http.client#http.client.CannotSendRequest
class http.client.HTTPConnection(host, port=None, [timeout, ]source_address=None, blocksize=8192) An HTTPConnection instance represents one transaction with an HTTP server. It should be instantiated passing it a host and optional port number. If no port number is passed, the port is extracted from the host string if ...
python.library.http.client#http.client.HTTPConnection
HTTPConnection.blocksize Buffer size in bytes for sending a file-like message body. New in version 3.7.
python.library.http.client#http.client.HTTPConnection.blocksize
HTTPConnection.close() Close the connection to the server.
python.library.http.client#http.client.HTTPConnection.close
HTTPConnection.connect() Connect to the server specified when the object was created. By default, this is called automatically when making a request if the client does not already have a connection.
python.library.http.client#http.client.HTTPConnection.connect
HTTPConnection.endheaders(message_body=None, *, encode_chunked=False) Send a blank line to the server, signalling the end of the headers. The optional message_body argument can be used to pass a message body associated with the request. If encode_chunked is True, the result of each iteration of message_body will be c...
python.library.http.client#http.client.HTTPConnection.endheaders
HTTPConnection.getresponse() Should be called after a request is sent to get the response from the server. Returns an HTTPResponse instance. Note Note that you must have read the whole response before you can send a new request to the server. Changed in version 3.5: If a ConnectionError or subclass is raised, the ...
python.library.http.client#http.client.HTTPConnection.getresponse
HTTPConnection.putheader(header, argument[, ...]) Send an RFC 822-style header to the server. It sends a line to the server consisting of the header, a colon and a space, and the first argument. If more arguments are given, continuation lines are sent, each consisting of a tab and an argument.
python.library.http.client#http.client.HTTPConnection.putheader
HTTPConnection.putrequest(method, url, skip_host=False, skip_accept_encoding=False) This should be the first call after the connection to the server has been made. It sends a line to the server consisting of the method string, the url string, and the HTTP version (HTTP/1.1). To disable automatic sending of Host: or A...
python.library.http.client#http.client.HTTPConnection.putrequest
HTTPConnection.request(method, url, body=None, headers={}, *, encode_chunked=False) This will send a request to the server using the HTTP request method method and the selector url. If body is specified, the specified data is sent after the headers are finished. It may be a str, a bytes-like object, an open file obje...
python.library.http.client#http.client.HTTPConnection.request
HTTPConnection.send(data) Send data to the server. This should be used directly only after the endheaders() method has been called and before getresponse() is called.
python.library.http.client#http.client.HTTPConnection.send
HTTPConnection.set_debuglevel(level) Set the debugging level. The default debug level is 0, meaning no debugging output is printed. Any value greater than 0 will cause all currently defined debug output to be printed to stdout. The debuglevel is passed to any new HTTPResponse objects that are created. New in version...
python.library.http.client#http.client.HTTPConnection.set_debuglevel
HTTPConnection.set_tunnel(host, port=None, headers=None) Set the host and the port for HTTP Connect Tunnelling. This allows running the connection through a proxy server. The host and port arguments specify the endpoint of the tunneled connection (i.e. the address included in the CONNECT request, not the address of t...
python.library.http.client#http.client.HTTPConnection.set_tunnel
exception http.client.HTTPException The base class of the other exceptions in this module. It is a subclass of Exception.
python.library.http.client#http.client.HTTPException
class http.client.HTTPResponse(sock, debuglevel=0, method=None, url=None) Class whose instances are returned upon successful connection. Not instantiated directly by user. Changed in version 3.4: The strict parameter was removed. HTTP 0.9 style “Simple Responses” are no longer supported.
python.library.http.client#http.client.HTTPResponse
HTTPResponse.closed Is True if the stream is closed.
python.library.http.client#http.client.HTTPResponse.closed
HTTPResponse.debuglevel A debugging hook. If debuglevel is greater than zero, messages will be printed to stdout as the response is read and parsed.
python.library.http.client#http.client.HTTPResponse.debuglevel
HTTPResponse.fileno() Return the fileno of the underlying socket.
python.library.http.client#http.client.HTTPResponse.fileno
HTTPResponse.getheader(name, default=None) Return the value of the header name, or default if there is no header matching name. If there is more than one header with the name name, return all of the values joined by ‘, ‘. If ‘default’ is any iterable other than a single string, its elements are similarly returned joi...
python.library.http.client#http.client.HTTPResponse.getheader
HTTPResponse.getheaders() Return a list of (header, value) tuples.
python.library.http.client#http.client.HTTPResponse.getheaders
HTTPResponse.getstatus() Deprecated since version 3.9: Deprecated in favor of status.
python.library.http.client#http.client.HTTPResponse.getstatus
HTTPResponse.geturl() Deprecated since version 3.9: Deprecated in favor of url.
python.library.http.client#http.client.HTTPResponse.geturl
HTTPResponse.headers Headers of the response in the form of an email.message.EmailMessage instance.
python.library.http.client#http.client.HTTPResponse.headers
HTTPResponse.info() Deprecated since version 3.9: Deprecated in favor of headers.
python.library.http.client#http.client.HTTPResponse.info
HTTPResponse.msg A http.client.HTTPMessage instance containing the response headers. http.client.HTTPMessage is a subclass of email.message.Message.
python.library.http.client#http.client.HTTPResponse.msg
HTTPResponse.read([amt]) Reads and returns the response body, or up to the next amt bytes.
python.library.http.client#http.client.HTTPResponse.read
HTTPResponse.readinto(b) Reads up to the next len(b) bytes of the response body into the buffer b. Returns the number of bytes read. New in version 3.3.
python.library.http.client#http.client.HTTPResponse.readinto
HTTPResponse.reason Reason phrase returned by server.
python.library.http.client#http.client.HTTPResponse.reason
HTTPResponse.status Status code returned by server.
python.library.http.client#http.client.HTTPResponse.status
HTTPResponse.url URL of the resource retrieved, commonly used to determine if a redirect was followed.
python.library.http.client#http.client.HTTPResponse.url
HTTPResponse.version HTTP protocol version used by server. 10 for HTTP/1.0, 11 for HTTP/1.1.
python.library.http.client#http.client.HTTPResponse.version
class http.client.HTTPSConnection(host, port=None, key_file=None, cert_file=None, [timeout, ]source_address=None, *, context=None, check_hostname=None, blocksize=8192) A subclass of HTTPConnection that uses SSL for communication with secure servers. Default port is 443. If context is specified, it must be a ssl.SSLCo...
python.library.http.client#http.client.HTTPSConnection
http.client.HTTPS_PORT The default port for the HTTPS protocol (always 443).
python.library.http.client#http.client.HTTPS_PORT
http.client.HTTP_PORT The default port for the HTTP protocol (always 80).
python.library.http.client#http.client.HTTP_PORT
exception http.client.ImproperConnectionState A subclass of HTTPException.
python.library.http.client#http.client.ImproperConnectionState
exception http.client.IncompleteRead A subclass of HTTPException.
python.library.http.client#http.client.IncompleteRead
exception http.client.InvalidURL A subclass of HTTPException, raised if a port is given and is either non-numeric or empty.
python.library.http.client#http.client.InvalidURL
exception http.client.LineTooLong A subclass of HTTPException. Raised if an excessively long line is received in the HTTP protocol from the server.
python.library.http.client#http.client.LineTooLong
exception http.client.NotConnected A subclass of HTTPException.
python.library.http.client#http.client.NotConnected
http.client.parse_headers(fp) Parse the headers from a file pointer fp representing a HTTP request/response. The file has to be a BufferedIOBase reader (i.e. not text) and must provide a valid RFC 2822 style header. This function returns an instance of http.client.HTTPMessage that holds the header fields, but no payl...
python.library.http.client#http.client.parse_headers
exception http.client.RemoteDisconnected A subclass of ConnectionResetError and BadStatusLine. Raised by HTTPConnection.getresponse() when the attempt to read the response results in no data read from the connection, indicating that the remote end has closed the connection. New in version 3.5: Previously, BadStatusL...
python.library.http.client#http.client.RemoteDisconnected
exception http.client.ResponseNotReady A subclass of ImproperConnectionState.
python.library.http.client#http.client.ResponseNotReady
http.client.responses This dictionary maps the HTTP 1.1 status codes to the W3C names. Example: http.client.responses[http.client.NOT_FOUND] is 'Not Found'.
python.library.http.client#http.client.responses
exception http.client.UnimplementedFileMode A subclass of HTTPException.
python.library.http.client#http.client.UnimplementedFileMode
exception http.client.UnknownProtocol A subclass of HTTPException.
python.library.http.client#http.client.UnknownProtocol
exception http.client.UnknownTransferEncoding A subclass of HTTPException.
python.library.http.client#http.client.UnknownTransferEncoding
http.cookiejar — Cookie handling for HTTP clients Source code: Lib/http/cookiejar.py The http.cookiejar module defines classes for automatic handling of HTTP cookies. It is useful for accessing web sites that require small pieces of data – cookies – to be set on the client machine by an HTTP response from a web server,...
python.library.http.cookiejar
class http.cookiejar.Cookie This class represents Netscape, RFC 2109 and RFC 2965 cookies. It is not expected that users of http.cookiejar construct their own Cookie instances. Instead, if necessary, call make_cookies() on a CookieJar instance.
python.library.http.cookiejar#http.cookiejar.Cookie
Cookie.comment String comment from the server explaining the function of this cookie, or None.
python.library.http.cookiejar#http.cookiejar.Cookie.comment
Cookie.comment_url URL linking to a comment from the server explaining the function of this cookie, or None.
python.library.http.cookiejar#http.cookiejar.Cookie.comment_url
Cookie.discard True if this is a session cookie.
python.library.http.cookiejar#http.cookiejar.Cookie.discard
Cookie.domain_initial_dot True if the domain explicitly specified by the server began with a dot ('.').
python.library.http.cookiejar#http.cookiejar.Cookie.domain_initial_dot
Cookie.domain_specified True if a domain was explicitly specified by the server.
python.library.http.cookiejar#http.cookiejar.Cookie.domain_specified
Cookie.expires Integer expiry date in seconds since epoch, or None. See also the is_expired() method.
python.library.http.cookiejar#http.cookiejar.Cookie.expires
Cookie.get_nonstandard_attr(name, default=None) If cookie has the named cookie-attribute, return its value. Otherwise, return default.
python.library.http.cookiejar#http.cookiejar.Cookie.get_nonstandard_attr
Cookie.has_nonstandard_attr(name) Return True if cookie has the named cookie-attribute.
python.library.http.cookiejar#http.cookiejar.Cookie.has_nonstandard_attr
Cookie.is_expired(now=None) True if cookie has passed the time at which the server requested it should expire. If now is given (in seconds since the epoch), return whether the cookie has expired at the specified time.
python.library.http.cookiejar#http.cookiejar.Cookie.is_expired
Cookie.name Cookie name (a string).
python.library.http.cookiejar#http.cookiejar.Cookie.name
Cookie.path Cookie path (a string, eg. '/acme/rocket_launchers').
python.library.http.cookiejar#http.cookiejar.Cookie.path
Cookie.port String representing a port or a set of ports (eg. ‘80’, or ‘80,8080’), or None.
python.library.http.cookiejar#http.cookiejar.Cookie.port
Cookie.port_specified True if a port or set of ports was explicitly specified by the server (in the Set-Cookie / Set-Cookie2 header).
python.library.http.cookiejar#http.cookiejar.Cookie.port_specified
Cookie.rfc2109 True if this cookie was received as an RFC 2109 cookie (ie. the cookie arrived in a Set-Cookie header, and the value of the Version cookie-attribute in that header was 1). This attribute is provided because http.cookiejar may ‘downgrade’ RFC 2109 cookies to Netscape cookies, in which case version is 0.
python.library.http.cookiejar#http.cookiejar.Cookie.rfc2109
Cookie.secure True if cookie should only be returned over a secure connection.
python.library.http.cookiejar#http.cookiejar.Cookie.secure
Cookie.set_nonstandard_attr(name, value) Set the value of the named cookie-attribute.
python.library.http.cookiejar#http.cookiejar.Cookie.set_nonstandard_attr
Cookie.value Cookie value (a string), or None.
python.library.http.cookiejar#http.cookiejar.Cookie.value
Cookie.version Integer or None. Netscape cookies have version 0. RFC 2965 and RFC 2109 cookies have a version cookie-attribute of 1. However, note that http.cookiejar may ‘downgrade’ RFC 2109 cookies to Netscape cookies, in which case version is 0.
python.library.http.cookiejar#http.cookiejar.Cookie.version
class http.cookiejar.CookieJar(policy=None) policy is an object implementing the CookiePolicy interface. The CookieJar class stores HTTP cookies. It extracts cookies from HTTP requests, and returns them in HTTP responses. CookieJar instances automatically expire contained cookies when necessary. Subclasses are also r...
python.library.http.cookiejar#http.cookiejar.CookieJar
CookieJar.add_cookie_header(request) Add correct Cookie header to request. If policy allows (ie. the rfc2965 and hide_cookie2 attributes of the CookieJar’s CookiePolicy instance are true and false respectively), the Cookie2 header is also added when appropriate. The request object (usually a urllib.request.Request in...
python.library.http.cookiejar#http.cookiejar.CookieJar.add_cookie_header