self.contents = '%s%i: %s' % (self.contents, self.line, buf)

def __str__(self):
    return self.contents
retrieved_body = Storage()
retrieved_headers = Storage()
c = pycurl.Curl()
c.setopt(c.URL, 'http://www.demaziere.fr/eve/')
c.setopt(c.WRITEFUNCTION, retrieved_body.store)
c.setopt(c.HEADERFUNCTION, retrieved_headers.store)
c.perform()
c.close()
print(retrieved_headers)
print(retrieved_body)
Как прочитать заголовок с помощью pycurl