Created
August 27, 2015 14:35
-
-
Save Daenyth/b57f8522b388e66fcf3b to your computer and use it in GitHub Desktop.
Enable debug logging for python requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import logging | |
import httplib | |
# Debug logging | |
httplib.HTTPConnection.debuglevel = 1 | |
logging.basicConfig() | |
logging.getLogger().setLevel(logging.DEBUG) | |
req_log = logging.getLogger('requests.packages.urllib3') | |
req_log.setLevel(logging.DEBUG) | |
req_log.propagate = True |
I'm not up to date on python stuff these days, so I don't really know.
The HTTPConnection.debuglevel = 1
statement is magic; thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, @Daenyth!
I found a slightly different way to enable debug logging the logger for requests on the stackoverflow. What do you think about this?