pycurl

Putting a pyCurl XML server response into a variable (Python)

I'm a Python novice, trying to use pyCurl. The project I am working on is creating a Python wrapper for the twitpic.com API (http://twitpic.com/api.do). For reference purposes, check out the code (http://pastebin.com/f4c498b6e) and the error I'm getting (http://pastebin.com/mff11d31). Pay special attention to line 27 of the code, which ...

pycurl WRITEDATA WRITEFUNCTION collision/crash

How do i turnoff WRITEFUNCTION and WRITEDATA ? using pycurl i have a class call curlUtil. In it i have pageAsString(self, url) which returns a string. To do this i setopt WRITEFUNCTION. Now in downloadFile(self, url, fn, overwrite=0) i do an open and self.c.setopt(pycurl.WRITEFUNCTION, 0) which cause problems. int is not a valid argueme...

How to read the header with pycurl

How do I read the response headers returned from a PyCurl request? ...

How do i install pyCurl?

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 tri...

pycurl and unescape

curl_unescape doesnt seem to be in pycurl, what do i use instead? ...

pycurl request exist in header function?

in C do return -1 when i want to cancel the download in either the header or the write function. In pycurl i get this error pycurl.error: invalid return value for write callback -1 17 I dont know what the 17 means but what am i not doing correctly? ...

pycurl cancel a transfer and try & except

How do i cancel a transfer in pycurl? i use to return -1 in libcurl but pycurl doesnt seem to like that ("pycurl.error: invalid return value for write callback -1 17") return 0 doesnt work either, i get "error: (23, 'Failed writing body')" . Also how do i do a try/except with pycurl? i dont see any examples online nor the pycurl examples...

python runtime error, can dump a file?

I am using libcurl to DL a webpage, then i am scanning it for data and doing something with one of the links. However, once in a while the page is different then i except thus i extract bad data and pycurl throws an exception. I tried finding the exception name for pycurl but had no luck. Is there a way i can get the traceback to execut...

pycurl fails but curl (from bash) works in ubuntu

I'm using curl and pycurl to connect to a secure 3rd party api and when I use pycurl I'm getting authentication errors back from the server, but when I use curl on the command line and do the same thing it works. I set both to verbose mode and am seeing some differences in the request, but I can't seem to figure out what the error is. T...

how to use pycurl if requested data is sometimes gzipped, sometimes not?

I'm doing this to fetch some data: c = pycurl.Curl() c.setopt(pycurl.ENCODING, 'gzip') c.setopt(pycurl.URL, url) c.setopt(pycurl.TIMEOUT, 10) c.setopt(pycurl.FOLLOWLOCATION, True) xml = StringIO() c.setopt(pycurl.WRITEFUNCTION, xml.write ) c.perform() c.close() My urls are typically of this sort: http://host/path/to/resource-f...

pycurl: RETURNTRANSFER option doesn't exist

I'm using pycurl to access a JSON web API, but when I try to use the following: ocurl.setopt(pycurl.URL, gaurl) # host + endpoint ocurl.setopt(pycurl.RETURNTRANSFER, 1) ocurl.setopt(pycurl.HTTPHEADER, gaheader) # Send extra headers ocurl.setopt(pycurl.CUSTOMREQUEST, "POST") # HTTP POST req ocurl.setopt(pycurl.CONNECTTIMEOUT, 2) ...

Install pyCurl in ActivePython-2.6?

I have worked with pyCurl in the past and have it working with my system default python install. However, I have a project that requires python to be more portable and I am using ActivePython-2.6. I have had no problems installing any other modules so far, but am getting errors installing pyCurl. The error: Searching for pycurl Readi...

Why can't Python find shared objects that are in directories in sys.path?

I'm trying to import pycurl: $ python -c "import pycurl" Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: libcurl.so.4: cannot open shared object file: No such file or directory Now, libcurl.so.4 is in /usr/local/lib. As you can see, this is in sys.path: $ python -c "import sys; print sys.path" [''...

pycurl installation on Windows

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\D...

Alternative to PycURL ?

Hey, Here's a bit of code that is uploading a file: file_size = os.path.getsize('Tea.rdf') f = file('Tea.rdf') c = pycurl.Curl() c.setopt(pycurl.URL, 'http://localhost:8080/openrdf-sesame/repositories/rep/statements') c.setopt(pycurl.HTTPHEADER, ["Content-Type: application/rdf+xml;charset=UTF-8"]) c.setopt(pycurl.PUT, 1) ...

Automate interaction with a webpage in python

I want to automate interaction with a webpage. I've been using pycurl up til now but eventually the webpage will use javascript so I'm looking for alternatives . A typical interaction is "open the page, search for some text, click on a link (which opens a form), fill out the form and submit". We're deploying on Google App engine, if tha...

PyCURL: TLS Handshake Error

I'm using PyCURL to test a redirection service we're offering- a user hits http://xyz.com/asdf/ and gets redirected to https://a.com, https://b.com and https://c.com. I'm trying to use PyCURL to request http://xyz.com, and print out (but not HTTP request) the string "https://{a|b|c}.com", but whenever the destination URL is HTTPS and no...

get many pages with pycurl ?

I want to get many pages from a website, like curl "http://farmsubsidy.org/DE/browse?page=[0000-3603]" -o "de.#1" but get the pages' data in python, not disk files. Can someone please post pycurl code to do this, or fast urllib2 (not one-at-a-time) if that's possible, or else say "forget it, curl is faster and more robust" ? Thanks ...

What good tutorials exist for learning pycURL?

I'm planning on building my own FTP client in Python for learning purposes. I'm planning on using PycURL but the documentation seems to be lacking. What good tutorials are there for learning pycURL? ...

pycurl module not available after installation on Snow Leopard

I'm running Python 2.6.4 on Mac Snow Leopard. I installed pycurl using: sudo env ARCHFLAGS="-arch x86_64" easy_install setuptools pycurl==7.16.2.1 The installation completes with no issues and says pycurl is installed in subsequent installation attempts. However, when I try to "import pycurl" in a script, I get a message that pycurl i...