使用PyCurl发送HTTPGET的问题 [英] problem sending an HTTPGET with PyCurl
本文介绍了使用PyCurl发送HTTPGET的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在将以下curl命令转换为PyCurl时遇到问题:
I am having problems converting the following curl command into PyCurl:
curl -k --cert / tmp / blablablahttps: / blablabla
我到目前为止的尝试如下所示:
My attempt so far is shown below:
c = pycurl.Curl()
c.setopt(pycurl.URL, submit_url)
c.setopt(pycurl.HTTPGET, 1)
b = StringIO.StringIO()
c.setopt(pycurl.WRITEFUNCTION, b.write)
c.setopt(pycurl.FOLLOWLOCATION, 1)
c.setopt(pycurl.MAXREDIRS, 5)
c.setopt(pycurl.SSLCERT, cert)
c.setopt(pycurl.CAPATH,'/bla/bla/bla')
c.perform()
c.close()
这不起作用。
推荐答案
将--libcurl example.c添加到你的curl命令行来看看更好的curcur使用的libcurl选项,然后你可以将它们复制到你的pycurl程序,而不是迅速。
Add "--libcurl example.c" to your curl command line to get to see better what libcurl options curl uses, then you can copy them into your pycurl program rather swiftly.
这篇关于使用PyCurl发送HTTPGET的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文