访问浏览器后格式问题
来源:4-2 flask开发get接口
我要生10个
2019-09-15
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’
}
写回答
1回答
-
Mushishi
2019-09-16
你再lpostman中查看去,浏览器鼠标右键查看
022019-10-24
相似问题