Skip to content

Instantly share code, notes, and snippets.

@Daenyth
Created August 27, 2015 14:35
Show Gist options
  • Save Daenyth/b57f8522b388e66fcf3b to your computer and use it in GitHub Desktop.
Save Daenyth/b57f8522b388e66fcf3b to your computer and use it in GitHub Desktop.
Enable debug logging for python requests
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
@Daenyth
Copy link
Author

Daenyth commented Mar 2, 2020

I'm not up to date on python stuff these days, so I don't really know.

@rca
Copy link

rca commented Jun 19, 2020

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