import requests
x = requests.get("https://www.pap.fr/annonce/annonce-vente-france-g25-23")
print(x.url)
This url is redirected to "https://www.pap.fr/annonce/vente-immobiliere-france-g25"
, but the response url x
always shows "https://www.pap.fr/annonce/annonce-vente-france-g25-23"
.
The request.history
method doesn't work to, I tried to run this code on the url:
if response.history:
print("Request was redirected")
for resp in response.history:
print(resp.status_code, resp.url)
print("Final destination:")
print(response.status_code, response.url)
else:
print("Request was not redirected")
But it always shows the sent url...