Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/343.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在Flask restplus Api中使用基于方法参数的选择查询?_Python_Mysql_Select_Peewee_Flask Restplus - Fatal编程技术网

Python 如何在Flask restplus Api中使用基于方法参数的选择查询?

Python 如何在Flask restplus Api中使用基于方法参数的选择查询?,python,mysql,select,peewee,flask-restplus,Python,Mysql,Select,Peewee,Flask Restplus,我想在我的Flask REST API中处理GET请求。该请求将包括List参数,我使用该参数作为典型的GET请求: https://localhost:5000/organisation?List=1 此请求将返回所有组织型号信息Organization是MySQL数据库表的模型类(bypeewee) 我想在请求中输入PrivenceId参数,并将返回所有organization模型信息,其中organization.PrivencedId==PrivenceId参数,但我遇到以下错误: Ty

我想在我的
Flask REST API
中处理
GET
请求。该请求将包括
List
参数,我使用该参数作为典型的GET请求:

https://localhost:5000/organisation?List=1

此请求将返回所有
组织
型号信息
Organization
是MySQL数据库表的模型类(by
peewee

我想在请求中输入
PrivenceId
参数,并将返回所有
organization
模型信息,其中
organization.PrivencedId==PrivenceId
参数,但我遇到以下错误:
TypeError:“组织”对象不可编辑

我的代码(
OrganizationController.py
文件)是:

运行api的
boot.py
文件是:

from flask import Flask 
from flask_restplus import Api
from Controllers import OrganisationController


app = Flask(__name__)

api = Api(app)

api.add_resource(OrganisationController.List, '/organisation')


if __name__ == "__main__":

    app.run ('127.0.0.1', 5000, True)

你能帮我吗?

我更改了这行代码并解决了我的问题:

Organisations = Organisation.select().where
                         (
                         Organisation.ProvinceId ==args['ProvinceId']
                         )
Organisations = Organisation.select().where
                         (
                         Organisation.ProvinceId ==args['ProvinceId']
                         )