Skip to content

Instantly share code, notes, and snippets.

@nfredrik
Forked from Daenyth/debug_requests.py
Created December 15, 2021 14:43
Show Gist options
  • Save nfredrik/fc59117de26e4f349bc514ec27a3d676 to your computer and use it in GitHub Desktop.
Save nfredrik/fc59117de26e4f349bc514ec27a3d676 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