diff options
| author | Sorin Sbarnea <sorin.sbarnea@gmail.com> | 2013-04-10 16:15:28 +0100 |
|---|---|---|
| committer | Sorin Sbarnea <sorin.sbarnea@gmail.com> | 2013-04-10 16:15:28 +0100 |
| commit | 17ecb6891c515511ce33250a3f39f752a9c59b55 (patch) | |
| tree | c2650f268217b577178fc527d2e9ed0cc31860cf /docs | |
| parent | 2426eeb371a689f10439d54772664ee05570ab88 (diff) | |
| download | python-requests-17ecb6891c515511ce33250a3f39f752a9c59b55.tar.gz | |
* Documented the logging, requested in #1297
* Added build directory and *.egg to .gitignore
* Added sphinx as setup requirement in order to be able to build documentation with `pyhton setup.py build_sphinx`
modified: .gitignore
modified: docs/api.rst
modified: setup.py
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api.rst | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/docs/api.rst b/docs/api.rst index 771d7a82..dce19d3e 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") + requests_log.setLevel(logging.DEBUG) + requests_log.propagate = True + + requests.get('http://httpbin.org/headers') + Licensing |
