【发布时间】:2013-09-16 22:09:11
【问题描述】:
所以假设我在使用mechanize.Browser.retrieve 时收到了一个错误,并且我像这样捕获它:
try:
br.retrieve(url, fname)
except mechanize.HTTPError as e:
if e.code in [403, 404]:
# how can I get to the contents of the server-sent error page?
else:
raise
此时如何访问服务器发送的错误页面?
我尝试使用 br.response().get_data(),但使用 retrieve() 时似乎没有填充。
【问题讨论】:
标签: python-2.7 mechanize