[英]How to follow redirect in grequests?
How to follow redirect in grequests ? 如何在grequests中遵循重定向?
In requests library we can simply use : r = requests.get(url, allow_redirects=True)
to allow redirect . 在请求库中,我们可以简单地使用:
r = requests.get(url, allow_redirects=True)
允许重定向。
is there anything in grequests ? grequests中有什么吗?
i have checked https://pypi.org/project/grequests/ but did not found anything. 我已经检查了https://pypi.org/project/grequests/但没有发现任何东西。
Just 只是
grequests.get(u, allow_redirects=True)
would do , according to its source code, all parameters are passed to the session.request https://github.com/kennethreitz/grequests/blob/master/grequests.py#L71 根据其源代码会这样做,所有参数都传递给session.request https://github.com/kennethreitz/grequests/blob/master/grequests.py#L71
Maybe you should try https://github.com/requests/requests-threads 也许您应该尝试https://github.com/requests/requests-threads
Yes, You could follow the same pattern for grequests
. 是的,您可以对
grequests
遵循相同的模式。 If you look at the grequests
class you could see that the send
method itself delegating the call to the actual request.Session().request
method. 如果查看
grequests
类,您会发现send
方法本身将调用委派给实际的request.Session().request
方法。 So you could do 所以你可以做
rs = grequests.get(u, allow_redirects=True)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.