製作與Python模塊請求GET請求奇怪的url結束:Python的請求模塊結束了奇怪的重定向
>>> import requests
>>> r = requests.get("http://t.co/Uspy071j")
>>> print r.url
"http://feeds.feedburner.com/%257Er/LesArdoises/%257E3/bD2JuJagz5I/roxino-cest-tout-vert.html?utm_source=twitterfeed&utm_medium=twitter"
這個網址有錯誤400結束,但使用RestKit對同一個URL時, final_url返回正確的值:
>>> import restkit
>>> r = restkit.request("http://t.co/Uspy071j", follow_redirect=True)
>>> print r.final_url
"http://lesardoises.com/6277/roxino-cest-tout-vert.html?utm_medium=twitter&utm_source=twitterfeed"
請求的問題是什麼?
使用'curl'和以下三個'301'重定向,一些HTML終於取回。 – 2012-01-31 12:49:52