requests:Failed to establish a new c onnection

### I can run correctly in my pc，but unusual in Ali cloud server above.This problem has been bothering me three days.I expect someone can help me with this problem.

> On my Windows Server and Ubuntu Server，I conducted the following test  

``` python
import requests,sys
url='http://up.photo.qzone.qq.com/cgi-bin/upload/cgi_upload_image?g_tk=1541189572'
files ={'files':('s.jpg',open(sys.path[0]+'\\user\\1005052183437642\\image\\3951851877517768-0.jpg','rb'))}
r = requests.post(url, files=files)
print(r.text)
#I got a response, it shows my server can upload pictures to that server.
```

> But I run the entire program, to execute the above code where exceptionally.Here is my code snippet

``` python
#I think you do not need to consider the correctness of his, because the entire program can be run on my pc
files=self.i_f()
for i in p_list:
    files['filename']=(i[-20:],open(i, 'rb'))
    r=requests.post(url=u_url,cookies=self.cj,files=files,headers=self.headers)
    if self.p_r(r.text) is False:
        print('fail:',i)
    else:
            print('success:',i)
```

> Here is the exception code appears.
> 
> ``` python
> Microsoft Windows [版本 6.0.6002]
> 版权所有 (C) 2006 Microsoft Corporation。保留所有权利。
> upload_img_url: http://tjup.photo.qzone.qq.com/cgi-bin/upload/cgi_upload_image?g
> _tk=146481784
> Traceback (most recent call last):
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\packages\urllib3\connection.py", line 137, in _new_conn
>     (self.host, self.port), self.timeout, **extra_kw)
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\packages\urllib3\util\connection.py", line 91, in create_con
> nection
>     raise err
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\packages\urllib3\util\connection.py", line 81, in create_con
> nection
>     sock.connect(sa)
> TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没
> 有反应，连接尝试失败。
> #Note
> During handling of the above exception, another exception occurred:
> Traceback (most recent call last):
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\packages\urllib3\connectionpool.py", line 559, in urlopen
>     body=body, headers=headers)
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\packages\urllib3\connectionpool.py", line 353, in _make_requ
> est
>     conn.request(method, url, **httplib_request_kw)
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\htt
> p\client.py", line 1083, in request
>     self._send_request(method, url, body, headers)
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\htt
> p\client.py", line 1128, in _send_request
>     self.endheaders(body)
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\htt
> p\client.py", line 1079, in endheaders
>     self._send_output(message_body)
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\htt
> p\client.py", line 911, in _send_output
>     self.send(msg)
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\htt
> p\client.py", line 854, in send
>     self.connect()
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\packages\urllib3\connection.py", line 162, in connect
>     conn = self._new_conn()
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\packages\urllib3\connection.py", line 146, in _new_conn
>     self, "Failed to establish a new connection: %s" % e)
> requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urll
> ib3.connection.HTTPConnection object at 0x02168A10>: Failed to establish a new c
> onnection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反
> 应，连接尝试失败。
> #Note
> During handling of the above exception, another exception occurred:
> Traceback (most recent call last):
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\adapters.py", line 376, in send
>     timeout=timeout
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\packages\urllib3\connectionpool.py", line 609, in urlopen
>     _stacktrace=sys.exc_info()[2])
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\packages\urllib3\util\retry.py", line 273, in increment
>     raise MaxRetryError(_pool, url, error or ResponseError(cause))
> requests.packages.urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='tju
> p.photo.qzone.qq.com', port=80): Max retries exceeded with url: /cgi-bin/upload/
> cgi_upload_image?g_tk=146481784 (Caused by NewConnectionError('<requests.package
> s.urllib3.connection.HTTPConnection object at 0x02168A10>: Failed to establish a
>  new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机
> 没有反应，连接尝试失败。',))
> #Note
> During handling of the above exception, another exception occurred:
> Traceback (most recent call last):
>   File "main.py", line 10, in <module>
>     util.work(u,p)
>   File "C:\Users\Administrator\Documents\python\SnToTx\util.py", line 140, in wo
> rk
>     p(u,pwd,pic_list,text,video,tcn,r['mid'])
>   File "C:\Users\Administrator\Documents\python\SnToTx\util.py", line 94, in p
>     rt=rm.r(p_list,t,v,n)
>   File "C:\Users\Administrator\Documents\python\SnToTx\txModule\eModule\emotion.
> py", line 88, in r
>     r=requests.post(url=u_url,cookies=self.cj,files=files,headers=self.headers)
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\api.py", line 107, in post
>     return request('post', url, data=data, json=json, **kwargs)
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\api.py", line 53, in request
>     return session.request(method=method, url=url, **kwargs)
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\sessions.py", line 468, in request
>     resp = self.send(prep, **send_kwargs)
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\sessions.py", line 576, in send
>     r = adapter.send(request, **kwargs)
>   File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\sit
> e-packages\requests\adapters.py", line 437, in send
>     raise ConnectionError(e, request=request)
> requests.exceptions.ConnectionError: HTTPConnectionPool(host='tjup.photo.qzone.q
> q.com', port=80): Max retries exceeded with url: /cgi-bin/upload/cgi_upload_imag
> e?g_tk=146481784 (Caused by NewConnectionError('<requests.packages.urllib3.conne
> ction.HTTPConnection object at 0x02168A10>: Failed to establish a new connection
> : [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应，连接
> 尝试失败。',))
> C:\Users\Administrator\Documents\python\SnToTx>
> ```

The above is the cmd gives me the error message,If you need additional information, please leave a message.


Th error being received is "failed to establish a new connection" to host `tjup.photo.qzone.qq.com`. This is probably specific to your machine, because it's working fine here, so I suspect this is specific to your network.

Do you want to try seeing if you can connect directly to that host from your browser?


I've tried it, but now seems to have found where the problem is.

On my Windows server above,when i type `telnet tjup.photo.qzone.qq.com 80`,it shows connection fail. Then on my Windows 7,connection succeeded.   Perhaps this is where the problem is, do you think


@chengshuyi Almost certainly, yes. =)


Well, then i must solve this problem.Thank you for your attention