非多部分 post 使用 pycurl
Non multi part post using pycurl
我无法 post 数据到休息服务器,因为服务器不知道如何处理多部分 post 请求,并且在遇到边界时抛出错误。
有没有办法在pycurl中制作一个非多部分post?
为什么 post 请求需要是多部分的?
A POST 当然不必是多部分的,请参阅我也粘贴在这里的 pycurl 文档中的 this example:
c = pycurl.Curl()
c.setopt(c.URL, 'http://pycurl.io/tests/testpostvars.php')
post_data = {'field': 'value'}
# Form data must be provided already urlencoded.
postfields = urlencode(post_data)
# Sets request method to POST,
# Content-Type header to application/x-www-form-urlencoded
# and data to send in request body.
c.setopt(c.POSTFIELDS, postfields)
c.perform()
c.close()
我无法 post 数据到休息服务器,因为服务器不知道如何处理多部分 post 请求,并且在遇到边界时抛出错误。 有没有办法在pycurl中制作一个非多部分post? 为什么 post 请求需要是多部分的?
A POST 当然不必是多部分的,请参阅我也粘贴在这里的 pycurl 文档中的 this example:
c = pycurl.Curl()
c.setopt(c.URL, 'http://pycurl.io/tests/testpostvars.php')
post_data = {'field': 'value'}
# Form data must be provided already urlencoded.
postfields = urlencode(post_data)
# Sets request method to POST,
# Content-Type header to application/x-www-form-urlencoded
# and data to send in request body.
c.setopt(c.POSTFIELDS, postfields)
c.perform()
c.close()