La difficulté avec pycurl.POSTFIELDS

Je suis familier avec CURL en PHP, mais je suis de l'utiliser pour la première fois en Python avec pycurl.

Je reçois l'erreur:

Exception Type:     error
Exception Value:    (2, '')

Je n'ai aucune idée de ce que cela pourrait signifier. Voici mon code:

data = {'cmd': '_notify-synch',
        'tx': str(request.GET.get('tx')),
        'at': paypal_pdt_test
        }

post = urllib.urlencode(data)

b = StringIO.StringIO()

ch = pycurl.Curl()
ch.setopt(pycurl.URL, 'https://www.sandbox.paypal.com/cgi-bin/webscr')
ch.setopt(pycurl.POST, 1)
ch.setopt(pycurl.POSTFIELDS, post)
ch.setopt(pycurl.WRITEFUNCTION, b.write)
ch.perform()
ch.close()

L'erreur est en se référant à la ligne ch.setopt(pycurl.POSTFIELDS, post)

OriginalL'auteur Matt McCormick | 2010-01-06