一直在寻找和寻找,测试和尝试,阅读和阅读......我不是程序员,不会快速拿起这些东西。
这是我的代码:
import requests
url = 'http://company.page.com/member/index.php' (this url has the form on it)
values = {'username': 'myusernamehere',
'password': 'mypasswordhere'}
r = requests.post(url, data=values)
# Now you have logged in
url = "http://company.page.com/member/member.php" (this is the resulting url after logging in)
# sending cookies as well
result = requests.get(url, cookies=r.cookies)
print (result.headers)
print (result.text)
我得到错误:
<form action="http://company.page.com/member/index.php" method="post" id="login">
<h3 class="head">Donor Login</h3>
<em class="notice"><p class="errors">you must log in</p><br />
网站源代码的图像:(我可以弄清楚如何发布 html 的第一种方法)