Checking if a request redirects to a new URL determines if a webpage that received a request has redirected the requestor to a different URL.
Solution for How to check if a request redirects to a new URL in Python : You can use requests.get() and Response.history to check if a request redirects to a new URL Call requests.get(url) to make a GET request from the source url and return a Response object containing the server’s response to the request. Call Response.history with Response as the previous result to get a list of Response objects from the history of the request. Redirect responses are sorted in this list from oldest to most recent, if any. Use a for-loop to iterate through each Response in Response.history, and use the syntax Response.url to get the URL of each Response.