git://git.onelab.eu
/
plcapi.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
25e639bd6a2ba47ac12b0976531e062f80f2d98a
[plcapi.git]
/
trunk
/
pycurl
/
tests
/
test_stringio.py
1
#! /usr/bin/env python
2
# -*- coding: iso-8859-1 -*-
3
# vi:ts=4:et
4
# $Id$
5
6
import sys
7
try:
8
from cStringIO import StringIO
9
except ImportError:
10
from StringIO import StringIO
11
import pycurl
12
13
url = "http://curl.haxx.se/dev/"
14
15
print "Testing", pycurl.version
16
17
body = StringIO()
18
c = pycurl.Curl()
19
c.setopt(c.URL, url)
20
c.setopt(c.WRITEFUNCTION, body.write)
21
c.perform()
22
c.close()
23
24
contents = body.getvalue()
25
print contents