(Mar-16-2020, 05:02 PM)buran Wrote: the last url inresponse.history
is the same asresponse.url
after all redirects:
import requests url = 'http://jd.cn.hn/aeXb' response = requests.get(url) print([resp.url for resp in response.history]) print(response.url)if I run your code, I get the same:
Output:['http://jd.cn.hn/aeXb', 'https://www.weibo.com/', 'http://weibo.com/overseas'] https://www.weibo.com/overseas
I see just one difference between response.history and response.url - the schema http vs https
Output:301 http://jd.cn.hn/aeXb 302 https://www.weibo.com/ 301 http://weibo.com/overseas https://www.weibo.com/overseas
thanks for reply. that's why i ask here. i think we get link with wrong way. here is how it work in browser
imgur.com/a/2EyQDyK