Skip to content

Instantly share code, notes, and snippets.

@akagr
Created August 21, 2023 12:26
Show Gist options
  • Save akagr/6b4c1e4f8dbbf5c3244405351d21ff96 to your computer and use it in GitHub Desktop.
Save akagr/6b4c1e4f8dbbf5c3244405351d21ff96 to your computer and use it in GitHub Desktop.
Logging request data in python
import logging
from http.client import HTTPConnection
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
# request.get(...)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment