pythongrequests

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.


Solution

  • Yes, You could follow the same pattern for grequests. If you look at the grequests source code you could see that the send method itself delegating the call to the actual request.Session().request method. This means that you can simply do

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