我正在学习用Python爬行。你知道吗
我的目标是下载文件。你知道吗
我现在正在学习登录,很难。你知道吗
http://www.kif.re.kr/kif2/login/login.aspx?menuid=56
例如,我需要登录从这个站点下载文件。你知道吗
我查了各种资料。你知道吗
但我想要的网站似乎有点不同。你知道吗
我能够抓取大多数网站,不需要登录。你知道吗
但是,我不能爬网需要登录的网站。你知道吗
所以我真的很想学习这一部分。你知道吗
我的目标是登录,然后在html中查看爬行代码。你知道吗
下面是我的代码。这样做对吗?你知道吗
from requests import session
# ex) ID = abcd / PW = 1234
payload = {
'ctl00$ContentPlaceHolder1$tbxLoginID' : 'abcd',
'ctl00$ContentPlaceHolder1$tbxLoginPW' : '1234'
}
with session() as c:
c.post('http://www.kif.re.kr/kif2/login/login.aspx', data=payload)
response = c.get('What should I write here?')
# response = c.get('http://example.com/protected_page.php')
print(response.headers)
print(response.text)
您遗漏了一些登录数据表单,下面是有效负载的样子
写下受保护页面的url!如果你能成功地得到它,那么你就登录了。你知道吗
相关问题 更多 >
编程相关推荐