《1》
import requests
def getRealUrl(url):
re = request.get(url)
print(re.url)
《2》
import requests
def getRealUrl(url):
re = request.get(url)
if re.status_code == 302:
try:
print(re.headers['Location'])
except:
pass