标签:
pc = pycurl.Curl() pc.setopt(pycurl.POST, 1) pc.setopt(pycurl.URL, ‘http://192.168.0.25:/Image‘) #pc.setopt(pycurl.HTTPPOST, [(‘Img1‘, (pc.FORM_FILE, ‘1.jpg‘)), (‘Img2‘, (pc.FORM_FILE, ‘3.jpg‘))]) b1=open(‘1.jpg‘).read() b2=open(‘3.jpg‘).read() pc.setopt(pycurl.HTTPPOST, [ (‘Img1‘, (pc.FORM_BUFFER, ‘Img1‘, pc.FORM_BUFFERPTR, b1) ), ( ‘Img2‘, (pc.FORM_BUFFER, ‘Img2‘, pc.FORM_BUFFERPTR, b2) )] ) buf = StringIO.StringIO() pc.setopt(pycurl.WRITEFUNCTION, buf.write) pc.perform() response_code = pc.getinfo(pycurl.RESPONSE_CODE) print buf.getvalue() print response_code pc.close()
标签:
原文地址:http://www.cnblogs.com/ahuo/p/5783295.html