D
D
DUDE2021-07-25 14:08:21
Python
DUDE, 2021-07-25 14:08:21

How to see all redirects of a request?

I make a request and try to see the redirect history.

response = requests.get(url=...)

print(response.history)


I have a suspicion that not everyone falls there. Is there any other way to see all redirects?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-07-25
@stympel

Only redirects through HTTP 3XX response codes get there.
Javascript redirects or the meta-refresh tag will work in the browser, but requests doesn't process them and therefore doesn't know anything about them.
Another possible mechanism is a DNS CNAME record for the requested domain name. I'm not sure about its implementability and interaction with requests, but I doubt it will be noticed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question