summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorKenneth Reitz <me@kennethreitz.com>2013-04-15 03:21:40 -0400
committerKenneth Reitz <me@kennethreitz.com>2013-04-15 03:21:40 -0400
commit636476e704b8b8f747fab72e15be417b2dd08847 (patch)
treef3c0f91a4c7c1cdb6fbf72328278c3fdb47a9a22 /docs
parentaafca7acdc52331dbfb76fb30c2836fd504b2025 (diff)
parenta527ecfabdaa150469a58ee537fded6e97d80e10 (diff)
downloadpython-requests-636476e704b8b8f747fab72e15be417b2dd08847.tar.gz
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'docs')
-rw-r--r--docs/api.rst20
1 files changed, 17 insertions, 3 deletions
diff --git a/docs/api.rst b/docs/api.rst
index 771d7a82..89733a29 100644
--- a/docs/api.rst
+++ b/docs/api.rst
@@ -165,9 +165,23 @@ API Changes
::
- # Verbosity should now be configured with logging
- my_config = {'verbose': sys.stderr}
- requests.get('http://httpbin.org/headers', config=my_config) # bad!
+ import requests
+ import logging
+
+ # these two lines enable debugging at httplib level (requests->urllib3->httplib)
+ # you will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but without DATA.
+ # the only thing missing will be the response.body which is not logged.
+ import httplib
+ httplib.HTTPConnection.debuglevel = 1
+
+ logging.basicConfig() # you need to initialize logging, otherwise you will not see anything from requests
+ logging.getLogger().setLevel(logging.DEBUG)
+ requests_log = logging.getLogger("requests.packages.urllib3")
+ requests_log.setLevel(logging.DEBUG)
+ requests_log.propagate = True
+
+ requests.get('http://httpbin.org/headers')
+
Licensing