curl-and-python

Re: having a hard time converting PHP to Python

From: Arye - GMail <aryeh_at_bigfoot.com>
Date: Thu, 15 Nov 2007 17:01:17 +0100

Dear Nathan E. Moore,
Thanks for your time and your insight. This is exactly what I needed.
All the best,
Arye.
Nathan E. Moore 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 2007-11-15