Skip to content

Instantly share code, notes, and snippets.

@lacerdaeduardo
Created August 27, 2020 13:56
Show Gist options
  • Save lacerdaeduardo/2aaedb1e15c43e8fb91d14e5ab904656 to your computer and use it in GitHub Desktop.
Save lacerdaeduardo/2aaedb1e15c43e8fb91d14e5ab904656 to your computer and use it in GitHub Desktop.
Enable Python requests debug log level
import logging
from http.client import HTTPConnection # py3
log = logging.getLogger('urllib3')
log.setLevel(logging.DEBUG)
# logging from urllib3 to console
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
log.addHandler(ch)
# print statements from `http.client.HTTPConnection` to console/stdout
HTTPConnection.debuglevel = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment