Re: having a hard time converting PHP to Python

From: Nathan E. Moore <>
Date: Wed, 14 Nov 2007 16:13:52 -0500

--On Wednesday, November 14, 2007 6:41 PM +0100 Arye - GMail
<> 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:
> 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
for more details.

Nathan E. Moore
Received on 2007-11-14