Skip to content
Myr

* Documented the logging, requested in #1297

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

* 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`

authored by Sorin Sbarnea · committed by Sorin Sbarnea · parent 2426eeb · Browse files · 3 files+20 added−3 removed
This commit

State

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

Trailers

  • modified: .gitignore
  • modified: docs/api.rst
  • modified: setup.py

Diff stats

3 files+20 added−3 removed

  • other:+20 added−3 removed

3 files+20 added−3 removed

modified:docs/api.rst+17 added-3 removed
163 unmodified lines
164 configuring logging.165166 ::167168 # Verbosity should now be configured with logging169 my_config = {'verbose': sys.stderr}170 requests.get('http://httpbin.org/headers', config=my_config) # bad!168 import requests169 import logging170171 # these two lines enable debugging at httplib level (requests->urllib3->httplib)172 # you will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but without DATA.173 # the only thing missing will be the response.body which is not logged.174 import httplib175 httplib.HTTPConnection.debuglevel = 1176 177 logging.basicConfig() # you need to initialize logging, otherwise you will not see anything from requests178 logging.getLogger().setLevel(logging.DEBUG)179 requests_log = logging.getLogger("requests")180 requests_log.setLevel(logging.DEBUG)181 requests_log.propagate = True182 183 requests.get('http://httpbin.org/headers')184185186187Licensing188~~~~~~~~~189190One key difference that has nothing to do with the API is a change in the
7 unmodified lines
modified:.gitignore+2 added
5 unmodified lines
6pylint.txt7toy.py8violations.pyflakes.txt9cover/10build/11docs/_build12requests.egg-info/13*.pyc14*.swp15*.egg16env/1718.workon19
3 unmodified lines
modified:setup.py+1 added
37 unmodified lines
38 package_data={'': ['LICENSE', 'NOTICE'], 'requests': ['*.pem']},39 package_dir={'requests': 'requests'},40 include_package_data=True,41 install_requires=requires,42 setup_requires=['sphinx'],43 license=open('LICENSE').read(),44 zip_safe=False,45 classifiers=(46 'Development Status :: 5 - Production/Stable',
13 unmodified lines