curl-and-python

Trouble posting data

From: Kertis, Dennis <dkertis_at_vocollect.com>
Date: Mon, 16 Mar 2009 19:12:42 -0400

Hello,

 

I am having a hard time getting pycurl to post data with the formcurl
API. I was able to get it to work using the POSTFIELDS option, but not
with the HTTPPOST. I want to use the HTTPPOST option because it seems
easier to handle forms with <input type="file" ...> fields. My sample
code is almost straight out of the post2 test. So, can anyone advise on
how to get this working????

 

Thanks,

Dennis

  

import pycurl

 

pf = [('j_username', 'admin'),

        ('j_password', 'admin')

       ]

 

c = pycurl.Curl()

c.setopt(pycurl.URL,
'http://localhost:8080/MyApp/j_acegi_security_check')

c.setopt(pycurl.HTTPPOST, pf)

try:

    result = c.perform()

    print result

except pycurl.error, v:

    print v

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2009-03-17