If body is an iterable, the elements of the Method will be encoded as ISO-8859-1, otherwise the data returned by Instance of io.TextIOBase, the data returned by the read() Object, the contents of the file is sent this file object should Is a bytes-like object, the bytes are sent as is. Is a string, it is encoded as ISO-8859-1, the default for HTTP. Open file object, or an iterable of bytes. If body is specified, the specified data is sent after the headers areįinished. (unless connecting to an HTTP proxy server or using the OPTIONS or The provided url must beĪn absolute path to conform with RFC 2616 §5.1.2 This will send a request to the server using the HTTP request request ( method, url, body = None, headers =, *, encode_chunked = False ) ¶ ![]() HTTPConnection instances have the following methods: HTTPConnection. See HTTP status codes for a list of HTTP status codes that areĪvailable in this module as constants. This dictionary maps the HTTP 1.1 status codes to the W3C names.Įxample: is 'Not Found'. The default port for the HTTPS protocol (always 443). The default port for the HTTP protocol (always 80). The constants defined in this module are: http.client. New in version 3.5: Previously, BadStatusLine ('') was raised. Results in no data read from the connection, indicating that the remote end Raisedīy HTTPConnection.getresponse() when the attempt to read the response RemoteDisconnected ¶Ī subclass of ConnectionResetError and BadStatusLine. Is received in the HTTP protocol from the server. LineTooLong ¶Ī subclass of HTTPException. BadStatusLine ¶Ī subclass of HTTPException. ResponseNotReady ¶Ī subclass of ImproperConnectionState. CannotSendHeader ¶Ī subclass of ImproperConnectionState. CannotSendRequest ¶Ī subclass of ImproperConnectionState. ImproperConnectionState ¶Ī subclass of HTTPException. IncompleteRead ¶Ī subclass of HTTPException. UnimplementedFileMode ¶Ī subclass of HTTPException. UnknownTransferEncoding ¶Ī subclass of HTTPException. UnknownProtocol ¶Ī subclass of HTTPException. InvalidURL ¶Ī subclass of HTTPException, raised if a port is given and is either NotConnected ¶Ī subclass of HTTPException. The base class of the other exceptions in this module. ![]() The following exceptions are raised as appropriate: exception http.client. Read these field lines, so the first line should already be consumed Parse_headers() does not parse the start-line of a HTTP message The optional blocksize parameter sets the buffer size in bytes forįor example, the following calls all create instances that connect to the server To use as the source address the HTTP connection is made from. The optional source_address parameter may be a tuple of a (host, port) (if it is not given, the global default timeout setting is used). Operations (like connection attempts) will timeout after that many seconds If the optional timeout parameter is given, blocking String if it has the form host:port, else the default HTTP port (80) is If no port number is passed, the port is extracted from the host It should be instantiated by passing it a host and optional port HTTPConnection ( host, port=None, source_address=None, blocksize=8192 ) ¶Īn HTTPConnection instance represents one transaction with an HTTP The module provides the following classes: class http.client. WebAssembly platforms for more information. This module does not work or is not available on WebAssembly platforms
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |