【发布时间】:2012-02-20 09:15:02
【问题描述】:
我正在尝试加载一个 url,但我收到了这个错误:
DownloadError: ApplicationError: 2 Too many重复重定向
这是我正在使用的代码:
headers = { 'User-Agent' : 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; de-at) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1' }
url = "http://www.cafebonappetit.com/menu/your-cafe/collins-cmc/cafes/details/50/collins-bistro"
cmcHTM = urlfetch.fetch(url=url)
cmcHTML = str(cmcHTM.content)
我检查这个网站的重定向在:http://www.internetofficer.com/seo-tool/redirect-check/ 我发现这个网站被重定向到它自己!所以 url fetch 似乎在试图加载这个页面。 同时,这个页面在我的浏览器中加载得很好。
所以我尝试使用此代码:
cmcHTM = urlfetch.fetch(url=url,
follow_redirects=False,
deadline=100
)
这只是没有返回任何东西。有没有办法得到这个html?!
【问题讨论】:
标签: google-app-engine redirect urlfetch