Resolved: Python – Resolve response Remote URL link with actual page

In this post, we will see how to resolve Python – Resolve response Remote URL link with actual page

Question:

I am trying to get the actual page URL using the remote URL from JSON response. Below is the remote URL I get in an JSON API response.
when I click the link, it resolves to actual page when opened in browser which in this case is
How can programatically get this resolved URL without opening in browser ?

Best Answer:

IIUC, use requests.head with allow_redirects=True to ask for the final URL :
Output : ​

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com