简体   繁体   中英

How to follow redirect in grequests?

How to follow redirect in grequests ?

In requests library we can simply use : r = requests.get(url, allow_redirects=True) to allow redirect .

is there anything in grequests ?

i have checked https://pypi.org/project/grequests/ but did not found anything.

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

Maybe you should try https://github.com/requests/requests-threads

Yes, You could follow the same pattern for 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. So you could do

rs = grequests.get(u, allow_redirects=True)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM