Describe the bug
For url using http protocol, python.http-client still generates conn = http.client.HTTPSConnection. Python would throw SSL error when running the script.
To Reproduce
Steps to reproduce the behavior:
- Open postman, put
http://localhost:3000 into the url input box.
- Generate code with python - http.client.
- Put snippet into
test.py and run python3 test,py, you will see the SSL error.
Expected code snippet and corresponding request
Change http.client.HTTPSConnection to http.client.HTTPConnection would resolve the issue. Complete code:
import http.client
conn = http.client.HTTPConnection("localhost", 3000)
payload = ''
headers = {}
conn.request("GET", "/", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Screenshots
Current postman screenshot:

Additional context
N/A