New submission from Alejandro MJ: I'm trying this specific method with python, in order to use a different ip source, to do a POST request:
import http.client, urllib.parse data = urllib.parse.urlencode({'QLastname': 'DIAZ HERNANDEZ', 'QFirstname': 'JAIME'}) headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"} conn = http.client.HTTPConnection("www.infobel.com",80, source_address=("16.19.109.51", 0)) conn.request("POST", "/es/spain/people.aspx", data, headers) response = conn.getresponse() print(response.status, response.reason) data = response.read() conn.close() It works perfectly when I test it without a proxy, but when I try with proxy connection, I receive this error: >>> conn.request("POST", "/es/spain/people.aspx", data, headers) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python34\lib\http\client.py", line 1090, in request self._send_request(method, url, body, headers) File "C:\Python34\lib\http\client.py", line 1128, in _send_request self.endheaders(body) File "C:\Python34\lib\http\client.py", line 1086, in endheaders self._send_output(message_body) File "C:\Python34\lib\http\client.py", line 924, in _send_output self.send(msg) File "C:\Python34\lib\http\client.py", line 859, in send self.connect() File "C:\Python34\lib\http\client.py", line 836, in connect self.timeout, self.source_address) File "C:\Python34\lib\socket.py", line 509, in create_connection raise err File "C:\Python34\lib\socket.py", line 500, in create_connection sock.connect(sa) TimeoutError: [WinError 10060] Se produjo un error durante el intento... How could I follow proxy configuration in this script? This is the code I made to test with proxy (following the documentation of Python): import http.client, urllib.parse data = urllib.parse.urlencode({'QLastname': 'DIAZ HERNANDEZ', 'QFirstname': 'JAIME'}) headers={"Content-Type":"application/x-www-form-urlencoded","Accept":"text/plain"} conn = http.client.HTTPConnection(proxy_url,8080, source_address=(ipAddress, 0)) conn.set_tunnel("www.infobel.com") conn.request("POST", "/es/spain/people.aspx", data, headers) response = conn.getresponse() print(response.status, response.reason) data = response.read() conn.close() I could't make it work in this SO: SUSE Linux Enterprise Server 11 (x86_64) VERSION = 11 PATCHLEVEL = 2 The message that proxy give us is this: 2014-07-22 08:31:49 87 16.19.109.51 23.2.2.22 - - - PROXIED "none" - 200 TCP_ACCELERATED CONNECT - tcp www.infobel.com 80 / - - - 23.2.2.22 39 39 - 2014-07-22 08:31:49 1 16.19.109.51 23.2.2.22 - - dns_unresolved_hostname PROXIED "none" - 404 TCP_ERR_MISS POST - http cachebdvg1.igrupobbva 8080 /es/spain/people.aspx - aspx - 23.2.2.22 815 230 - So I tried to prove it in other SO, such as Windows, in a different computer. A curious thing... I've tried this with Python3.4.1 in Windows, and it didn't work. But when I proved with Python3.3.5 it works!! Thanks for help. ---------- components: Windows messages: 223688 nosy: AlexMJ priority: normal severity: normal status: open title: http POST request with python 3.3 through web proxy type: behavior versions: Python 3.4, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22041> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com