为了账号安全,请及时绑定邮箱和手机立即绑定

模块“请求”不通过登录

模块“请求”不通过登录

长风秋雁 2021-09-14 21:00:15
我正在尝试使用该requests模块从网站获取信息。要获取信息,您必须先登录,然后才能访问该页面。我查看了输入标签并注意到它们被调用login_username,login_password但由于某些原因post没有通过。我还在这里读到他通过在浏览另一页之前等待几秒钟来解决它,它也没有帮助..这是我的代码:import requestsimport time#This URL will be the URL that your login form points to with the "action" tag.loginurl = 'https://jadepanel.nephrite.ro/login'#This URL is the page you actually want to pull down with requests.requesturl = 'https://jadepanel.nephrite.ro/clan/view/123'payload = {    'login_username': 'username',    'login_password': 'password'}with requests.Session() as session:    post = session.post(loginurl, data=payload)    time.sleep(3)    r = session.get(requesturl)    print(r.text)
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 140 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信