I have a simple call to hit an amazon product page:
response = requests.get('https://www.amazon.com/dp/...')
print(response.url)
print(response.history
When I physically navigate to the page in my browser (chrome), I get redirected to a new product page that's not the one I searched.
My response however, doesn't seem to pick up the redirects and the history is empty and the response url is the same as what I requested. I have tested this on other URLs that I know redirect, but those work fine. It's only when dealing with Amazon.com/dp/productId pages.
I want to capture that redirect URL, but am unable to. Any idea what might be going wrong here?
Edit: Some additional insights. It appears that the redirect occurs after it navigates to the site. So something in the page javascript I believe might be what's triggering it to redirect, so my basic request.get() never picks it up.
[https://stackoverflow.com/a/55662431/21951045](https://stackoverflow.com/a/55662431/21951045)
– Writa H May 31 '23 at 05:42