我正在用python写一个战网屏幕抓取器,我想抓取
this page
。
问题是,当我尝试使用我的脚本下载它时,我会得到一个404。
然而,在网络浏览器中查看它也很好。
如果有帮助的话,这是我正在使用的代码(
requests
需要):
def download(url, max_retries=10):
for i in range(max_retries):
print('Downloading: ' + url)
r = requests.get(url)
print('Status code: ' + str(r.status_code))
if r.status_code == requests.codes.ok: return r.content
return None
download('http://us.battle.net/sc2/en/game/unit')
谢谢你的回答。