git://git.onelab.eu
/
plcapi.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
accept SessionAuth
[plcapi.git]
/
pycurl
/
examples
/
basicfirst.py
1
#! /usr/bin/env python
2
# -*- coding: iso-8859-1 -*-
3
# vi:ts=4:et
4
# $Id$
5
6
import sys
7
import pycurl
8
9
class Test:
10
def __init__(self):
11
self.contents = ''
12
13
def body_callback(self, buf):
14
self.contents = self.contents + buf
15
16
print >>sys.stderr, 'Testing', pycurl.version
17
18
t = Test()
19
c = pycurl.Curl()
20
c.setopt(c.URL, 'http://curl.haxx.se/dev/')
21
c.setopt(c.WRITEFUNCTION, t.body_callback)
22
c.perform()
23
c.close()
24
25
print t.contents