我正在尝试使用该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)
添加回答
举报
0/150
提交
取消