Stéphane Wirtel <steph...@wirtel.be> added the comment: Hi Lye,
I am not sure it's a bug because I don't have any problem with your script. Here is your script. import urllib import urllib.request my_url = "https://api.foo.com" my_headers = { "Content-Type" : "application/x-www-form-urlencoded" } my_data = { "client_id" : "ppp", "client_secret" : "000", "grant_type" : "client_credentials" } req = urllib.request.Request(url=my_url, data=my_data, headers=my_headers) response = urllib.request.urlopen(req) html = response.read() print(html) and here is the result with the version 3.6 of Python: > docker run --rm -v $PWD:/src -it python:3.6 python /src/demo.py Traceback (most recent call last): File "/usr/local/lib/python3.6/urllib/request.py", line 1318, in do_open encode_chunked=req.has_header('Transfer-encoding')) ... File "/usr/local/lib/python3.6/socket.py", line 713, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/src/demo.py", line 12, in <module> response = urllib.request.urlopen(req) ... File "/usr/local/lib/python3.6/urllib/request.py", line 1320, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [Errno 111] Connection refused> I don't get your error. and the version of this docker image is 3.6.8 > docker run --rm -v $PWD:/src -it python:3.6 python --version Python 3.6.8 ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36064> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com