cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Newbie pycurl question

From: John Blakeley <john.blakeley_at_mon.bbc.co.uk>
Date: Wed, 19 Jun 2002 08:13:18 +0000 (UTC)

Morning

On 18 Jun 2002, Kjetil Jacobsen wrote:
> > Correct me if I am wrong: I had a quick look through the src, and it looks
> > like PUT and UPLOAD have not been implemented in pycurl yet.
>
> hello, it appears you're wrong ;)

I have absolutely no problem with being proved wrong ;^)

> something like this should work for put (untested):
>
> ----------------------------------
>
> import os, pycurl
>
> url = 'http://url.to.put/'
> filename = '/filename/to/put'
> filesize = os.path.getsize(filename)
>
> f = open(filename)
> c = pycurl.init()
> c.setopt(pycurl.URL, url)
> c.setopt(pycurl.PUT, 1)
> c.setopt(pycurl.INFILE, f)
> c.setopt(pycurl.INFILESIZE, filesize)
> c.perform()
> c.cleanup()
>
> ----------------------------------

I can now confirm that the above (slightly corrected) code does work, very
nicely.

> hope this helps,

Very much. Thank you.

Salut/.

J/.

This e-mail (and any attachments) is confidential and may contain personal
views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system, do not use,
copy or disclose the information in any way nor act in reliance on it and notify
the sender immediately.
Please note that the BBC monitors e-mails sent
or received. Further communication will signify your consent to this.

----------------------------------------------------------------------------
                   Bringing you mounds of caffeinated joy
>>> http://thinkgeek.com/sf <<<
Received on 2002-06-19