Skip to content
Myr

Update example for Python 2/3 compatible.

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

authored by shoma · committed by shoma · parent ceb88ac · Browse files · 1 file+5 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+5 added−3 removed

  • other:+5 added−3 removed

1 file+5 added−3 removed

modified:docs/api.rst+5 added-3 removed
182 unmodified lines
183184 import requests185 import logging186187 # these two lines enable debugging at http.client level (requests->urllib3->http.client)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 from http.client import HTTPConnection # for Python 3191 from httplib import HTTPConnection # for Python 2, httplib is former name of http.client.190 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)
73 unmodified lines