import requests
url = 'http://www.heibanke.com/lesson/crawler_ex01/'
for i in range(30):
data={
'csrfmiddlewaretoken': 'O0J07BwA6Q7vxSzslTWBT20UDW9P0Nwk',
'username': 'Test_c',
'password': i,
}
html = requests.post(url,data=data)
if '密码错误' in html.text:
print('密码错误')
else:
print(html.text)
print('密码是:',i)
break