You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
u'<html><body>You are being <a href="https://toutiao.io/k/fsntvg">redirected</a>.</body></html>'
343
+
[<Response [302]>]
346
344
347
-
>>> r.history[1].text
348
-
u'<html><body>You are being <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Fzj429%2Fexplore-python%2Fcommit%2F%3Cspan+class%3D"x x-first x-last">https://funhacks.net/2016/12/06/flask_react_news/?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io">redirected</a>.</body></html>'
345
+
>>> r.history[0].text
346
+
u'<html><body>You are being <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Fzj429%2Fexplore-python%2Fcommit%2F%3Cspan+class%3D"x x-first x-last">http://www.jianshu.com/p/490441391db6?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io">redirected</a>.</body></html>'
>>> headers = {'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'}
365
-
>>> r = requests.get('https://toutiao.io/shares/789751/url', headers=headers, allow_redirects=False)
366
-
>>> r.status_code
367
-
200
363
+
>>> r = requests.get('https://toutiao.io/k/c32y51', headers=headers, allow_redirects=False)
368
364
>>> r.url # 禁止重定向,响应对象的 url 跟请求对象一致
369
-
u'https://toutiao.io/shares/789751/url'
365
+
u'https://toutiao.io/k/c32y51'
370
366
>>> r.history
371
367
[]
372
368
>>> r.text
373
-
u'<html><body>You are being <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Fzj429%2Fexplore-python%2Fcommit%2F%3Cspan+class%3D"x x-first x-last">https://toutiao.io/k/fsntvg">redirected</a>.</body></html>'
369
+
u'<html><body>You are being <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2Fzj429%2Fexplore-python%2Fcommit%2F%3Cspan+class%3D"x x-first x-last">http://www.jianshu.com/p/490441391db6?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io">redirected</a>.</body></html>'
0 commit comments