def get_headers():
return {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36'
}
def write_html(text, filename):
"""
将返回的响应信息写入文件
:param text: 响应页面内容
:param filename: 保存的文件名
:return:
"""
with open(filename, 'w', encoding='utf-8') as f:
f.write(text)