curl-and-python

Re: having a hard time converting PHP to Python

From: Arye <aryeh_at_bigfoot.com>
Date: Wed, 2 Apr 2008 10:01:59 +0200

Hello again,
Is there any way I could make this work with version 7.12.1 of pycurl?

It seems that there was not attribute FORM_FILE in module pycurl version
7.12.1.
Or is there an other way I can do a multipart/form-data post with pycurl
version 7.12.1 ?

My problem is that upgrading to the current version of pycurl on Red Hat
Enterprise Linux 4 is not so easy because of the many dependencies of
libcurl.

Any help would be greatly appreciated.
Regards,
Arye.

On Wed, Nov 14, 2007 at 11:13 PM, Nathan E. Moore <nate_at_redtetrahedron.org>
wrote:

> --On Wednesday, November 14, 2007 6:41 PM +0100 Arye - GMail
> <aryeh_at_bigfoot.com> wrote:
>
> > Hello all,
> > I am new to the list so sorry for the stupid questions...
> >
> > I have no success in converting this PHP code to Python:
> <snip>
> > Parameters = {'rm':'importFileContr',
> > 'rf':'importProduct',
> > 'sl':merchant_serial,
> > 'FILENAME':'c:/webserver/htdocs/pp_files/pp_product.csv'}
> ># Do not forget '@' before the file to be called
> >
> > dataupdate=urllib.urlencode(Parameters)
> >
>
> Your PHP is doing a multipart/form-data post not a
> application/x-www-form-urlencoded post. (at least according to the PHP
> documentation. To do a multipart/form-data post from pycurl, you need to
> use the HTTPPOST option. It's usage from python is a little different than
> from c (or PHP) see
> <
> http://pycurl.cvs.sourceforge.net/*checkout*/pycurl/pycurl/tests/test_post2.py?revision=1.13&content-type=text%2Fplain
> >
> and
> <http://curl.haxx.se/mail/curlpython-2007-03/0003.html>
> for more details.
>
> Nathan E. Moore
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2008-04-02