curl-and-python

Re: defer downloading the response body when making GET request

From: Dima Tisnek <dimaqq_at_gmail.com>
Date: Mon, 15 Dec 2014 08:31:44 +0100

curl already does what you see in requests, all you need is WRITEFUNCTION.

wrt. HEAD, that's not what requests does, and in practice would be a
semantic change, regardless of HTTP spec. Proceed at your own risk.

On 15 December 2014 at 08:24, iMath <2281570025_at_qq.com> wrote:
> By default, when you make a request, the body of the response is downloaded
> immediately. You can override this behaviour in Requests module and defer
> downloading the response body until you access the Response.content
> attribute with the stream parameter, described here
> http://docs.python-requests.org/en/latest/user/advanced/#body-content-workflow
>
>
> I wonder if pycurl can do the same thing.
>
> What I want to do here is to get the direct url of a few URLs having
> redirections ,it would be better if this could be done asynchronously .You
> may see I could use HEAD to do this, but the server I am sending request to
> seems doesn't support HEAD, so this seems the only way I can go ,can I use
> pycurl do the same thing here ?
>
> I have no experience in pycurl, as deadline of my project approaches, it
> would be better to show some code, thanks!!!‍
>
>
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
>

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2014-12-15