Skip to content

Instantly share code, notes, and snippets.

@eweitz
Forked from tonetheman/http_debugging.py
Last active November 12, 2022 20:32
Show Gist options
  • Save eweitz/90f88f5d84f8fea356a4 to your computer and use it in GitHub Desktop.
Save eweitz/90f88f5d84f8fea356a4 to your computer and use it in GitHub Desktop.
Debug requests for urllib in Python 3
"""" Tested in Python 3.4 """
import urllib.request
import http.client
http.client.HTTPConnection.debuglevel = 1
response = urllib.request.urlopen('https://github.com/eweitz')
@jujhars13
Copy link

Works just fine in python 3.7.3 on Raspbian Buster 👍

@wheelerlaw
Copy link

Not working on Python 3.10.7

@wheelerlaw
Copy link

wheelerlaw commented Nov 12, 2022

Not working on Python 3.10.7

Opened a PR in cpython: python/cpython#99353 (Respect http.client.HTTPConnection.debuglevel in urllib.request.AbstractHTTPHandler)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment