pythonpython-2.7flask-restless

create_api_blueprint() got an unexpected keyword argument 'page_size'


I am new to python. I have used Flask-Restless (0.17.0) for a python2.7 app.

After creating an API like so:

manager = flask_restless.APIManager(app, flask_sqlalchemy_db=db) 
manager.create_api(Roles, page_size=0, methods=['GET'])

It shows the following error:

File "server.py", line 146, in <module>  
manager.create_api(XXXX, page_size=0, methods=['GET'])
File "/usr/local/lib/python2.7/dist-packages/flask_restless/manager.py", line 698, in create_api
blueprint = self.create_api_blueprint(app=app, *args, **kw)
TypeError: create_api_blueprint() got an unexpected keyword argument 'page_size     unable to load app 0 (mountpoint='') (callable not found or import error)

Solution

  • SimpleBeat is right, the page_size attribute does exist in the version 1.0.0 beta but not in the stable 0.17.0 release.

    In v0.17.0 you can use the results_per_page and max_results_per_page attributes to change or disable pagination instead:

    manager.create_api(Roles, results_per_page=0, methods=['GET'])