2
ich pycurl bin mit POST-Anfrage mit Datei als Anhang senden:pycurl Typeerror: ungültiges Argument setopt
d = pycurl.Curl()
d.setopt(pycurl.URL, url)
# d.setopt(pycurl.RETURNTRANSFER, True)
d.setopt(pycurl.POST, True)
d.setopt(pycurl.POSTFIELDS, {filename: "@" + filename})
b = StringIO.StringIO()
d.setopt(pycurl.WRITEFUNCTION, b.write)
d.perform()
d.close()
message = b.getvalue()
und ich bekomme:
Something went wrong, invalid arguments to setopt
Traceback (most recent call last):
File "hasoff.py", line 214, in create_offers_for_advertiser
if filename:
TypeError: invalid arguments to setopt
Was ist los?
ich aus diesem Beispiel POSTFIELDS Attribut bekam: http://paste.org.ru/?70oc9c – paus
@paus dieses Beispiel auf PHP geschrieben ist, nicht Python. Curl API ist für diese Sprachen unterschiedlich. Sie können den PHP-spezifischen '@ $ filename' nicht mit' pycurl' verwenden. –