all()
获取请求。这是中的代码
api.py
from flask import Blueprint
from ..extensions import db
from ..models.users import Users
api = Blueprint('api', __name__)
@api.route('/user/<name>')
def get_user(email):
users = Users.query.first()
return {'users': users.email}
以上代码起作用
GET http://127.0.0.1:5000/user/anythingHere
在邮递员报税表中:
{
"users": "test@example.com"
}
应用程序编程接口。py公司
from flask import Blueprint
from ..extensions import db
from ..models.users import Users
api = Blueprint('api', __name__)
@api.route('/user/<name>')
def get_user(email):
users = Users.query.filter_by(email='<name>').first()
return {'users': users.email}
在邮差奔跑中
http://127.0.0.1:5000/user/test@example.com
希望如此
test@example.com
<name>
在里面
filter_by(email='<name>')
TypeError: get_user() got an unexpected keyword argument 'name'
在我的终端和邮递员中:
<!doctype html>
<html lang=en>
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or
there is an error in the application.</p>