pycurl

PyCurl request hangs infinitely on perform

PyCurl request hangs infinitely on perform Question: I have written a script to fetch scan results from Qualys to be run each week for the purpose of metrics gathering. The first part of this script involves fetching a list of references for each of the scans that were run in the past week for further …

Total answers: 2

Execute curl command within a Python script

Execute curl command within a Python script Question: 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 …

Total answers: 9

"Could not run curl-config: [Errno 2] No such file or directory" when installing pycurl

"Could not run curl-config: [Errno 2] No such file or directory" when installing pycurl Question: I’m trying to install pycurl via: sudo pip install pycurl It downloaded fine, but when when it runs setup.py I get the following traceback: Downloading/unpacking pycurl Running setup.py egg_info for package pycurl Traceback (most recent call last): File “<string>”, line …

Total answers: 13

Convert curl example to pycurl

Convert curl example to pycurl Question: Could someone convert the following PostMark curl example to pycurl? curl -X POST "http://api.postmarkapp.com/email" -H "Accept: application/json" -H "Content-Type: application/json" -H "X-Postmark-Server-Token: ed742D75-5a45-49b6-a0a1-5b9ec3dc9e5d" -v -d "{From: ‘[email protected]’, To: ‘[email protected]’, Subject: ‘Postmark test’, HtmlBody: ‘<html><body><strong>Hello</strong> dear Postmark user.</body></html>’}" Asked By: Darth || Source Answers: You can use something like this. …

Total answers: 1

How do I get the IP address from a http request using the requests library?

How do I get the IP address from a http request using the requests library? Question: I am making HTTP requests using the requests library in python, but I need the IP address from the server that responded to the HTTP request and I’m trying to avoid making two calls (and possibly having a different …

Total answers: 2

SSL backend error when using OpenSSL

SSL backend error when using OpenSSL Question: I was trying to install pycurl in a virtualenv using pip and I got this error ImportError: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (none/other) I read some documentation saying that “To fix this, you need to tell setup.py what SSL backend is …

Total answers: 26

PycURL Attachments and Progress Functions

PycURL Attachments and Progress Functions Question: Working on a small project utilising an API that you send a request to and then it gives you back a response with a zip file attached which you then download. My first pass at automating this download tried to utilise the setopt(curl.WRITEDATA, fp) function but this proceeded to …

Total answers: 1

Python Requests vs PyCurl Performance

Python Requests vs PyCurl Performance Question: How does the Requests library compare with the PyCurl performance wise? My understanding is that Requests is a python wrapper for urllib whereas PyCurl is a python wrapper for libcurl which is native, so PyCurl should get better performance, but not sure by how much. I can’t find any …

Total answers: 4

pycurl and SSL cert

pycurl and SSL cert Question: 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 …

Total answers: 4