I have seen this thread already - How can I unshorten a URL?
My issue with the resolved answer (that is using the unshort.me API) is that I am focusing on unshorteni
one line functions, using requests library and yes, it supports recursion.
def unshorten_url(url): return requests.head(url, allow_redirects=True).url