我在公司的服务器上部署了pyspider,最近发现公司内部的的代理使用不了(之前是可以的),而在同一部机器上用wget试了同样的网址就没问题。不知道大家有没有遇到过同样的问题,目前没什么头绪呢。代码顺便也贴一下好了。具体代理信息涉及到公司秘密我就不贴出来了,不过绝对不是代理的信息写错了,查看好几遍了。
wget -SO /dev/null -q -e "http-proxy=***" --proxy-user=*** --proxy-passwd=*** -T 5 -t 3 https://play.google.com/store/apps/category/PRODUCTIVITY/collection/topselling_free?hl=ms
下面是python的代码
from pyspider.libs.base_handler import *
class CommonRankingHandler(BaseHandler):
def on_start(self):
url = 'https://play.google.com/store/apps/category/PRODUCTIVITY/collection/topselling_free?hl=ms'
self.crawl(url ,
callback=self.ranking_list_page,
proxy=***,
)
def ranking_list_page(self, response):
print response
报错信息如下:
[E 160929 16:05:31 base_handler:194] HTTP 599: Proxy CONNECT aborted
Traceback (most recent call last):
File "/data/project/app_info_crawler/package/pyspider/libs/base_handler.py", line 187, in run_task
result = self._run_task(task, response)
File "/data/project/app_info_crawler/package/pyspider/libs/base_handler.py", line 166, in _run_task
response.raise_for_status()
File "/data/project/app_info_crawler/package/pyspider/libs/response.py", line 183, in raise_for_status
raise http_error
HTTPError: HTTP 599: Proxy CONNECT aborted
你设置代理的用户名密码了吗