http: How to get redirect location in Python

get_redirect.py
response = httpx.post("https://my.domain/api/redirect") 
# Get redirect location
if response.has_redirect_location:
    redirect_location = response.headers['Location']
else:
    redirect_location = None

 


Check out similar posts by category: Python