Skip to content

Instantly share code, notes, and snippets.

@joswr1ght
Created January 4, 2023 13:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joswr1ght/4924b4428b0eb2962f62f970638d68f4 to your computer and use it in GitHub Desktop.
Save joswr1ght/4924b4428b0eb2962f62f970638d68f4 to your computer and use it in GitHub Desktop.
Add this code to Python scripts to debug HTTP requests activity and see request/response data
import logging
import requests
import http.client
http.client.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
requests_log = logging.getLogger("requests.packages.urllib3")
requests_log.setLevel(logging.DEBUG)
requests_log.propagate = True
# requests.get(url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment