def Login():
username = request.args.get(“username”)
password = request.args.get(“password”)
if username and password:
data = json.dumps({
‘username’:username,
‘password’:password,
‘code’:‘200’,
‘message’:‘登陆成功’,
‘info’:‘www.baidu.com’
},indent=4,ensure_ascii=False)
else:
data = json.dumps({
‘message’:‘请传递参数!’
},indent=4,ensure_ascii=False)
return data
浏览器访问实际结果:
{ “username”: “qing”, “password”: “123456”, “code”: “200”, “message”: “登陆成功”, “info”: “www.baidu.com” }
预期结果:
{
‘username’:qing,
‘password’:123456,
‘code’:‘200’,
‘message’:‘登陆成功’,
‘info’:‘www.baidu.com’
}