| | |
- exceptions.Exception
-
- HTTPException
-
- BadStatusLine
- IllegalKeywordArgument
- ImproperConnectionState
-
- CannotSendHeader
- CannotSendRequest
- ResponseNotReady
- IncompleteRead
- NotConnected
- UnimplementedFileMode
- UnknownProtocol
- UnknownTransferEncoding
- HTTPException
-
- BadStatusLine
- IllegalKeywordArgument
- ImproperConnectionState
-
- CannotSendHeader
- CannotSendRequest
- ResponseNotReady
- IncompleteRead
- NotConnected
- UnimplementedFileMode
- UnknownProtocol
- UnknownTransferEncoding
- FakeSocket
- HTTP
-
- HTTPS
- HTTPConnection
-
- HTTPSConnection
- HTTPResponse
class FakeSocket |
| |
|
| |
- __getattr__(self, attr)
- __init__(self, sock, ssl)
- makefile(self, mode, bufsize=None)
- Return a readable file-like object with data from socket.
This method offers only partial support for the makefile
interface of a real socket. It only supports modes 'r' and
'rb' and the bufsize argument is ignored.
The returned object contains *all* of the file data
- recv(self, len=1024, flags=0)
- send(self, stuff, flags=0)
|
class HTTP |
| |
Compatibility class with httplib.py from 1.5. |
| |
- __init__(self, host='', port=None, **x509)
- Provide a default host, since the superclass requires one.
- close(self)
- connect(self, host=None, port=None)
- Accept arguments to set the host/port, since the superclass doesn't.
- getfile(self)
- Provide a getfile, since the superclass' does not use this concept.
- getreply(self)
- Compat definition since superclass does not define it.
Returns a tuple consisting of:
- server status code (e.g. '200' if all goes well)
- server "reason" corresponding to status code
- any RFC822 headers in the response from the server
- putheader(self, header, *values)
- The superclass allows only one value argument.
- set_debuglevel(self, debuglevel)
|
class HTTPConnection |
| |
|
| |
- __init__(self, host, port=None)
- _send_request(self, method, url, body, headers)
- _set_hostport(self, host, port)
- close(self)
- Close the connection to the HTTP server.
- connect(self)
- Connect to the host and port specified in __init__.
- endheaders(self)
- Indicate that the last header line has been sent to the server.
- getresponse(self)
- Get the response from the server.
- putheader(self, header, value)
- Send a request header line to the server.
For example: h.putheader('Accept', 'text/html')
- putrequest(self, method, url)
- Send a request to the server.
`method' specifies an HTTP request method, e.g. 'GET'.
`url' specifies the object being requested, e.g. '/index.html'.
- request(self, method, url, body=None, headers={})
- Send a complete request to the server.
- send(self, str)
- Send `str' to the server.
- set_debuglevel(self, level)
|
class HTTPResponse |
| |
|
| |
- __init__(self, sock, debuglevel=0)
- _safe_read(self, amt)
- Read the number of bytes requested, compensating for partial reads.
Normally, we have a blocking socket, but a read() can be interrupted
by a signal (resulting in a partial read).
Note that we cannot distinguish between EOF and an interrupt when zero
bytes have been read. IncompleteRead() will be raised in this
situation.
This function should be used when <amt> bytes "should" be present for
reading. If the bytes are truly not available (due to EOF), then the
IncompleteRead exception can be used to detect the problem.
- begin(self)
- close(self)
- getheader(self, name, default=None)
- isclosed(self)
- read(self, amt=None)
|
class HTTPSConnection(HTTPConnection) |
| |
This class allows communication via SSL. |
| |
- __init__(self, host, port=None, **x509)
- _send_request(self, method, url, body, headers) from HTTPConnection
- _set_hostport(self, host, port) from HTTPConnection
- close(self) from HTTPConnection
- connect(self)
- Connect to a host on a given (SSL) port.
- endheaders(self) from HTTPConnection
- getresponse(self) from HTTPConnection
- putheader(self, header, value) from HTTPConnection
- putrequest(self, method, url) from HTTPConnection
- request(self, method, url, body=None, headers={}) from HTTPConnection
- send(self, str) from HTTPConnection
- set_debuglevel(self, level) from HTTPConnection
|
|