Debian Codegraph @

examples/quickstart/file_upload_buffer.py

raw
1 #! /usr/bin/env python
2 # vi:ts=4:et
3
4 import pycurl
5
6 c = pycurl.Curl()
7 c.setopt(c.URL, 'https://httpbin.org/post')
8
9 c.setopt(c.HTTPPOST, [
10 ('fileupload', (
11 c.FORM_BUFFER, 'readme.txt',
12 c.FORM_BUFFERPTR, 'This is a fancy readme file',
13 )),
14 ])
15
16 c.perform()
17 c.close()