7fdf153ee5b6ac0b3ef135afe0c25c6a9b584f57
[plcapi.git] / pycurl / tests / test_stringio.py
1 #! /usr/bin/env python
2 # -*- coding: iso-8859-1 -*-
3 # vi:ts=4:et
4 # $Id: test_stringio.py,v 1.6 2003/04/21 18:46:11 mfx Exp $
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