Skip to content

Instantly share code, notes, and snippets.

@norpol
Forked from Daenyth/debug_requests.py
Created August 21, 2018 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save norpol/87a4a136535daf23f353300f46528d3c to your computer and use it in GitHub Desktop.
Save norpol/87a4a136535daf23f353300f46528d3c 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment