Skip to content
Myr

Merge pull request #2976 from shoma/fix-debug-logging-doc

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix api doc of debug logging for Python 3

authored by Cory Benfield · committed by Cory Benfield · parents d76f304, 75c7e5f · Browse files · 1 file+6 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−3 removed

  • other:+6 added−3 removed

1 file+6 added−3 removed

modified:docs/api.rst+6 added-3 removed
182 unmodified lines
183184 import requests185 import logging186187 # these two lines enable debugging at httplib level (requests->urllib3->httplib)187 # Enabling debugging at http.client level (requests->urllib3->http.client)188 # you will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but without DATA.189 # the only thing missing will be the response.body which is not logged.190 import httplib191 httplib.HTTPConnection.debuglevel = 1190 try: # for Python 3191 from http.client import HTTPConnection192 except ImportError:193 from httplib import HTTPConnection194 HTTPConnection.debuglevel = 1195196 logging.basicConfig() # you need to initialize logging, otherwise you will not see anything from requests197 logging.getLogger().setLevel(logging.DEBUG)198 requests_log = logging.getLogger("requests.packages.urllib3")
72 unmodified lines