Debian Codegraph @

examples/quickstart/file_upload_real_fancy.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 # upload the contents of this file
12 c.FORM_FILE, __file__,
13 # specify a different file name for the upload
14 c.FORM_FILENAME, 'helloworld.py',
15 # specify a different content type
16 c.FORM_CONTENTTYPE, 'application/x-python',
17 )),
18 ])
19
20 c.perform()
21 c.close()