Debian Codegraph @

examples/quickstart/put_file.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/put')
8
9 c.setopt(c.UPLOAD, 1)
10 file = open(__file__)
11 c.setopt(c.READDATA, file)
12
13 c.perform()
14 c.close()
15 # File must be kept open while Curl object is using it
16 file.close()