【发布时间】:2017-02-07 19:59:59
【问题描述】:
我正在使用 pycURL 通过 http 代理向 https 站点发出一些请求。
这是我的代码:
import pycurl
buf = cStringIO.StringIO()
c = pycurl.Curl()
c.setopt(c.URL, url) # 'url' is the base url of the form https://www.target.com
c.setopt(c.PROXY, proxy) # 'proxy' has the form 1.2.3.4:8080
c.setopt(c.WRITEFUNCTION, buf.write)
c.perform()
我用不同的代理尝试过这段代码。我得到Proxy CONNECT aborted 或Received HTTP code 400 from proxy after CONNECT。
我有什么遗漏吗?我应该改用 https 代理吗?我环顾四周,似乎找不到任何有关 pycURL 用法的帮助或文档。
任何帮助表示赞赏。谢谢!
【问题讨论】:
-
sudo apt-get -qy install wireshark,你就能看到 HTTP 出了什么问题,也许 curl -L 也有。顺便说一句,有趣的错误,我看不出来
标签: python python-2.7 curl proxy pycurl