#! /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)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| file_upload_buffer.py | File | 311 B | 0644 |
|
| file_upload_real.py | File | 291 B | 0644 |
|
| file_upload_real_fancy.py | File | 483 B | 0644 |
|
| follow_redirect.py | File | 250 B | 0644 |
|
| form_post.py | File | 564 B | 0644 |
|
| get.py | File | 583 B | 0644 |
|
| get_python2.py | File | 447 B | 0644 |
|
| get_python2_https.py | File | 498 B | 0644 |
|
| get_python3.py | File | 403 B | 0644 |
|
| get_python3_https.py | File | 454 B | 0644 |
|
| put_buffer.py | File | 472 B | 0644 |
|
| put_file.py | File | 300 B | 0644 |
|
| response_headers.py | File | 2.05 KB | 0644 |
|
| response_info.py | File | 498 B | 0644 |
|
| write_file.py | File | 357 B | 0644 |
|