1、
网址:http://neeo.cc:6002/pinter/bank/page/login
2、
用户名:admin
密码:1234
3、
查看余额
4、
5、
不需要登录的代码和结果如下:
p = {"userName":"admin"}
response = requests.get(url="http://www.neeo.cc:6002/pinter/bank/api/query",params=p)
print(response.json())
结果:{'code': '1', 'message': '用户未登录', 'data': None}
结果:{'code': '1', 'message': '用户不合法', 'data': None}
response = requests.get(url="http://www.neeo.cc:6002/pinter/bank/api/query",params=p,cookies = {"JSESSIONID":"0CCF38CD50BD4B890289EF1CD59ADF9C; testfan-id=e71b4e2e-5912-4fe4-9bf2-ed85fa8691b3"})
print(response.json())
结果:{'code': '0', 'message': 'success', 'data': '$ 61,463,463'}
response = requests.get(url="http://www.neeo.cc:6002/pinter/bank/api/query",params=p,cookies = response.cookies.get_dict())
print(response.json())
结果:{'code': '0', 'message': 'success', 'data': '$ 89,275,201'}
6、
需要登录的代码和结果如下:
import requests
data = {
"userName":"admin",
"password":"1234",
}
response = requests.post(url="http://www.neeo.cc:6002/pinter/bank/api/login",data=data)
print(response.json())
结果:{'code': '0', 'message': 'success', 'data': None}
print(response.cookies)
结果:<RequestsCookieJar[<Cookie testfan-id=b3f5b24c-1c7e-4b92-866c-f0dae78ba4ba for www.neeo.cc/>]>
获取字典:
print(response.cookies.get_dict())
结果:{'testfan-id': '9eeb4052-0b5a-40d3-abe5-0de96399a79c'}