Debian Codegraph @

examples/quickstart/write_file.py

raw
1 #! /usr/bin/env python
2 # vi:ts=4:et
3
4 import pycurl
5
6 # As long as the file is opened in binary mode, response body
7 # can be written to it without decoding.
8 with open('out.html', 'wb') as f:
9 c = pycurl.Curl()
10 c.setopt(c.URL, 'http://pycurl.io/')
11 c.setopt(c.WRITEDATA, f)
12 c.perform()
13 c.close()