opt
/
hc_python
/
share
/
doc
/
pycurl
/
examples
/
quickstart
/
Go to Home Directory
+
Upload
Create File
root@0UT1S:~$
Execute
By Order of Mr.0UT1S
[DIR] ..
N/A
[DIR] __pycache__
N/A
file_upload_buffer.py
311 bytes
Rename
Delete
file_upload_real.py
291 bytes
Rename
Delete
file_upload_real_fancy.py
483 bytes
Rename
Delete
follow_redirect.py
250 bytes
Rename
Delete
form_post.py
564 bytes
Rename
Delete
get.py
583 bytes
Rename
Delete
get_python2.py
447 bytes
Rename
Delete
get_python2_https.py
498 bytes
Rename
Delete
get_python3.py
403 bytes
Rename
Delete
get_python3_https.py
454 bytes
Rename
Delete
put_buffer.py
472 bytes
Rename
Delete
put_file.py
300 bytes
Rename
Delete
response_headers.py
2.05 KB
Rename
Delete
response_info.py
498 bytes
Rename
Delete
write_file.py
357 bytes
Rename
Delete
#! /usr/bin/env python # -*- coding: utf-8 -*- # vi:ts=4:et import pycurl import certifi from StringIO import StringIO buffer = StringIO() c = pycurl.Curl() c.setopt(c.URL, 'http://pycurl.io/') c.setopt(c.WRITEDATA, buffer) # For older PycURL versions: #c.setopt(c.WRITEFUNCTION, buffer.write) c.setopt(c.CAINFO, certifi.where()) c.perform() c.close() body = buffer.getvalue() # Body is a string in some encoding. # In Python 2, we can print it without knowing what the encoding is. print(body)
Save