The documentation for the 'data' parameter of various functions was
inconsistant. The low-level function, used by every convenience API,
internally uses RequestEncodingMixin._encode_params which accepts list
of tuples as well as dictionaries, hence every function taking a data
parameter also accepts a list of tuple.
Keep the documentation short, but provide a link to Request for
details.
Specified the default argument for params that have a default in the docstring
so that the default is easier to see from the code. Modified the docstring in
api.py to match the docstring in sessions.py.
This is related to #1882 and #1685. By calling close on the session, we
clear the PoolManager operated by the Session and close all sockets.
Fixes#1882
Partially-fixes #1685
While debugging an issue I discovered requests was coming back with 200
response, when it really shouldn't have. It turns out this happened for
two reasons: the jetty server running the app was rather lame and
didn't fail the request as a Bad Request, and httplib was happy to let
malformed data through and call it success.
It turns out httplib's strict flag controls this behavior of whether or
not to validate the status line. The underlying urllib3 supports the
concept as well. There was a bug there to that is now fixed upstream.
The last step is exposing this through requests. This introduces a
supports_http0.9 flag to help control this behavior. It defaults to
to True to preserve the current behavior. Setting it to False will
allow the underlying HTTPConnection to validate the status line.
* prefetch now defaults to True, ensuring that by default, sockets
are returned to the urllib3 connection pool on request end
* sessions now have a close() method, notifying urllib3 to close pooled
connections
* the module-level API, e.g., `requests.get('http://www.google.com')`,
explicitly closes its session when finished
When prefetch is False, the open socket becomes part of the state of the
Response object, and it's the client's responsibility to read the whole
body, at which point the socket will be returned to the pool.
This argument can be either a string, containing the path to a
pem-formatted key and certificate chain, or a tuple of (cert, key).
When supplied a tuple, the values are paths to an SSL certificate
chain file and key, respectively.