pycurl

pycurl and SSL cert

非 Y 不嫁゛ 提交于 2019-12-02 20:21:00
I am trying to write a pycurl script to access a secured site (HTTPS). c = pycurl.Curl() c.setopt(pycurl.USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0') c.setopt(pycurl.URL, 'https://for-example-securedsite') c.setopt(pycurl.COOKIEFILE, 'cookie.txt') c.setopt(pycurl.COOKIEJAR, 'cookies.txt') c.setopt(pycurl.WRITEDATA, file("page.html","wb")) I am getting the below error.. pycurl.error: (60, 'SSL certificate problem, verify that the CA cert is OK. Details:\nerror:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed') The code failed,

pycurl installation on Windows

孤街浪徒 提交于 2019-12-02 18:27:57
I am not able to install pycurl on Windows on Python2.6. Getting following error: C:\Documents and Settings\vijayendra\Desktop\Downloads\pycurl-7.19.0>python setup.py install --curl-dir="C:\Documents and Settings\vijayendra\Desktop\Downloads\ curl-7.19.5-win32-ssl\curl-7.19.5" Using curl directory: C:\Documents and Settings\vijayendra\Desktop\Downloads\curl-7.19.5-win32-ssl\curl-7.19.5 Traceback (most recent call last): File "setup.py", line 210, in <module> assert os.path.isfile(o), o AssertionError: C:\Documents and Settings\vijayendra\Desktop\Downloads\curl-7.19.5-win32-ssl\curl-7.19.5\lib

Making an API call in Python with an API that requires a bearer token

浪尽此生 提交于 2019-12-02 16:58:32
Looking for some help with integrating a JSON API call into a Python program. I am looking to integrate the following API into a Python .py program to allow it to be called and the response to be printed. The API guidance states that a bearer token must be generated to allow calls to the API, which I have done successfully. However I am unsure of the syntax to include this token as bearer token authentication in Python API request. I can successfully complete the above request using cURL with a token included. I have tried "urllib" and "requests" routes but to no avail. Full API details: IBM X

Which is best in Python: urllib2, PycURL or mechanize?

我们两清 提交于 2019-12-02 13:47:54
Ok so I need to download some web pages using Python and did a quick investigation of my options. Included with Python: urllib - seems to me that I should use urllib2 instead. urllib has no cookie support, HTTP/FTP/local files only (no SSL) urllib2 - complete HTTP/FTP client, supports most needed things like cookies, does not support all HTTP verbs (only GET and POST, no TRACE, etc.) Full featured: mechanize - can use/save Firefox/IE cookies, take actions like follow second link, actively maintained (0.2.5 released in March 2011) PycURL - supports everything curl does (FTP, FTPS, HTTP, HTTPS,

HandShake Failure in python(_ssl.c:590)

丶灬走出姿态 提交于 2019-11-30 17:28:56
When I execute the below line, req = urllib2.Request(requestwithtoken) self.response = urllib2.urlopen(req,self.request).read() I am getting the following exception: SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake failure (_ssl.c:590) The thing is I am able to get the token by pinging the service by using curl . During the process of retrieving the token, all the certificates were verified. In turn, by using the generated token, i am not able to connect to the service. I am getting the above error while trying. What could be the reason for that? martin I was having the

How do i install pyCurl?

扶醉桌前 提交于 2019-11-30 06:25:00
问题 I am VERY new to python. I used libcurl with no problems and used pyCurl once in the past. Now i want to set it up on my machine and dev. However i have no idea how to do it. I rather not DL libcirl files and compile that along with pycurl, i want to know the simplest method. I have libcurl installed on my machine. i'm on windows, i tried DLing the sources and use pycurl setup script, i had no luck. 回答1: TL,DR Get a binary from this website: http://www.lfd.uci.edu/~gohlke/pythonlibs/ Direct

(转)[Errno 14] PYCURL ERROR 7 - \"couldn't connect to host\"

烂漫一生 提交于 2019-11-30 02:30:15
[Errno 14] PYCURL ERROR 7 - "couldn't connect to host" 转发:https://blog.csdn.net/weixin_43737815/article/details/89800349 关于[Errno 14] PYCURL ERROR 7 - "couldn’t connect to host"的解决方法 新的服务器指向原服务器的yum源,配置完成后进行 yum clean all操作和yum repolist 报错 [root@hadoop101 yum.repos.d]# yum repolist 已加载插件:fastestmirror, refresh-packagekit, security Determining fastest mirrors * extras: mirror.bit.edu.cn * updates: ap.stykers.moe http://192.168.1.100/cdrom/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7 - "couldn't connect to host" 尝试其他镜像。 http://192.168.1.100/cdrom/repodata/repomd.xml: [Errno 14] PYCURL ERROR 7

Screen scraping with Python

你说的曾经没有我的故事 提交于 2019-11-30 02:04:13
Does Python have screen scraping libraries that offer JavaScript support? I've been using pycurl for simple HTML requests, and Java's HtmlUnit for more complicated requests requiring JavaScript support. Ideally I would like to be able to do everything from Python, but I haven't come across any libraries that would allow me to do it. Do they exist? hoju There are many options when dealing with static HTML, which the other responses cover. However if you need JavaScript support and want to stay in Python I recommend using webkit to render the webpage (including the JavaScript) and then examine

Execute curl command within a Python script

本秂侑毒 提交于 2019-11-29 20:15:50
I am trying to execute a curl command within a python script. If I do it in the terminal, it looks like this: curl -X POST -d '{"nw_src": "10.0.0.1/32", "nw_dst": "10.0.0.2/32", "nw_proto": "ICMP", "actions": "ALLOW", "priority": "10"}' http://localhost:8080/firewall/rules/0000000000000001 I've seen recommendations to use pycurl , but I couldn't figure out how to apply it to mine. I tried using: subprocess.call([ 'curl', '-X', 'POST', '-d', flow_x, 'http://localhost:8080/firewall/rules/0000000000000001' ]) and it works, but is there a better way? You could use urllib as @roippi said: import

Pip Requirements.txt --global-option causing installation errors with other packages. “option not recognized”

非 Y 不嫁゛ 提交于 2019-11-29 13:51:23
I'm having difficulties with the --global-option and --install-option settings for a requirements.txt file. Specifying the options for one library is causing other libraries installs to fail. I'm trying to install Python libraries "grab" and "pycurl". I need to specify that pycurl be installed with option: "--with-nss". I can replicate the error on a completely clean virtual enviroment. On a new virtual environment With requirements.txt containing: grab==0.6.25 pycurl==7.43.0 --install-option='--with-nss' Then installing with: pip install -r requirements.txt The following errors will occur.