2013-04-29 77 views
2

我刚刚安装了Proximo heroku插件,用于python应用程序。我加载了一个shell并且踢了轮胎,并且打了一个HTTP地址,但HTTPS地址不能。 HTTP地址显示在Proximo日志中,HTTPS地址超时不会在日志中留下任何内容。对https请求的Proximo heroku插件超时

我用下面的代码进行测试:

import urllib2, urllib 
from django.conf import settings 

proxy = urllib2.ProxyHandler(settings.PROXIES_DICT) 
auth = urllib2.HTTPBasicAuthHandler() 
opener = urllib2.build_opener(proxy, auth, urllib2.HTTPHandler) 
urllib2.install_opener(opener) 

urllib2.urlopen("http://google.com").read() # works fine 
urllib2.urlopen("https://google.com").read() # times out 

我应该提到的PROXIES_DICT看起来像这样(密码替换):

>>> pprint(settings.PROXIES_DICT) 
{'http': 'http://proxy:[email protected]', 
'https': 'http://proxy:[email protected]'} 

我还要提到的超时异常看起来是这样的:

URLError: <urlopen error [Errno 60] Operation timed out> 

我不知道我在做什么错。谁能帮忙?

回答

3

此代码尝试使用HTTP连接到Proximo代理,但是连接到443端口。请尝试以下设置:

{'http': 'http://proxy:[email protected]', 
'https': 'http://proxy:[email protected]:80'} 

你知道,Proximo软体不会对HTTPS听,所以从应用程序到代理服务器连接不会被加密?

+0

明白了,谢谢。是的,我知道它不会在https上收听。并且,如果代理在我的客户端和服务器之间来回传递的数据仍然是加密的,那么代理服务器没有的实际连接就可以了。 – 2013-04-30 18:09:42