httplib slow read

Kjetil Jacobsen setattr at
Fri Dec 7 10:24:26 CET 2001

John Hunter <jdhunter at> wrote in message news:<m2u1v4w55n.fsf at mother.paradise.lost>...
> >>>>> "Kjetil" == Kjetil Jacobsen <setattr at> writes:
>     Kjetil> another option may be to use the pycurl module which wraps
>     Kjetil> the curl library:
> Thanks for the tip.  I have installed it and it looks nice.  One thing
> I have not been able to figure out is how to direct pycurl to print
> the HTTP header it would send were I too invoke 'perform'.  
> Something like
> import pycurl
> c = pycurl.init()
> c.setopt(pycurl.URL, '')
> c.setopt(pycurl.REFERER, '
> # tried this but it ain't right.
> print pycurl.HTTPHEADER
> How can I do this?

pycurl.HTTPHEADER is used to set additional headers which will be used
when doing the request.  see e.g. tests/ on how to use
the HTTPHEADER option to set custom headers.

afaik there is no way to get the header _before_ doing the actual
however, you can turn on the verbose flag:

c.setopt(pycurl.VERBOSE, 1)

which will print the header when perform() is invoked.

you may also use the pycurl.CUSTOMREQUEST to hand-craft your own
header to be used when doing the perform().

> Aside from the internal __doc__ and the cURL pages and the
> pycurl/tests files, is there any documentation I should be aware of?

pycurl closely follows the behaviour of libcurl. just remove the
CURLOPT_ prefix for setopt() and the CURLINFO_ prefix for getinfo().

i am not aware of any other documentation.

        - kjetil

More information about the Python-list mailing list