NO LONGER MAINTAINED - A Flask extension for creating simple ReSTful JSON APIs from SQLAlchemy models.

Overview

NO LONGER MAINTAINED

This repository is no longer maintained due to lack of time.

You might check out the fork https://github.com/mrevutskyi/flask-restless-ng instead.

Flask-Restless

Introduction

This is Flask-Restless, a Flask extension that creates URL endpoints that satisfy the requirements of the JSON API specification. It is compatible with models that have been defined using either SQLAlchemy or Flask-SQLAlchemy.

This document contains some brief instructions concerning installation of requirements, installation of this extension, configuration and usage of this extension, and building of documentation.

For more information, see the

Build status

Copyright license

The code comprising this program is copyright 2011 Lincoln de Sousa and copyright 2012, 2013, 2014, 2015, 2016 Jeffrey Finkelstein and contributors, and is dual-licensed under the following two copyright licenses:

  • the GNU Affero General Public License, either version 3 or (at your option) any later version
  • the 3-clause BSD License

For more information, see the files LICENSE.AGPL and LICENSE.BSD in this directory.

The documentation is licensed under the Creative Commons Attribution-ShareAlike 4.0 license.

Contents

This is a partial listing of the contents of this package.

  • LICENSE.AGPL - one possible copyright license under which this program is distributed to you (the GNU Affero General Public License version 3)
  • LICENSE.BSD - another possible copyright license under which this program is distributed to you (the 3-clause BSD License)
  • docs/ - the Sphinx documentation for Flask-Restless
  • examples/ - example applications of Flask-Restless
  • flask_restless/ - the Python package containing the extension
  • MANIFEST.in - indicates files to include when packaging Flask-Restless
  • README.md - this file
  • setup.py - Python setuptools configuration file for packaging this extension
  • tests/ - unit tests for Flask-Restless

The flask_restless directory is a Python package containing the following files and directory:

  • helpers.py - utility functions, mainly for performing introspection on SQLAlchemy objects
  • manager.py - contains the main class that end users will utilize to create ReSTful JSON APIs for their database models
  • search.py - functions and classes that facilitate searching the database on requests that require a search
  • serialization.py - basic serialization and deserialization for SQLAlchemy models
  • views/ - the view classes that implement the JSON API interface

Installing

This application can be used with any Python version that Flask supports, which currently includes versions 2.6, 2.7, 3.3, and 3.4. (Python 3.2 is not supported by Flask and therefore cannot be supported by Flask-Restless.)

This application requires the following libraries to be installed:

These requirements (and some additional optional packages) are also listed in the requirements/install.txt file. Using pip is probably the easiest way to install these:

pip install -r requirements/install.txt

Building as a Python egg

This package can be built, installed, etc. as a Python egg using the provided setup.py script. For more information, run

python setup.py --help

How to use

For information on how to use this extension, build the documentation here or view it on the Web.

Testing

If your Python interpreter is cpython, run:

pip install -r requirements/test-cpython.txt

Otherwise, if your Python interpreter is pypy, run:

pip install -r requirements/test-pypy.txt

To run the tests:

python setup.py test

Building documentation

Flask-Restless requires the following program and supporting library to build the documentation:

These requirements are also listed in the requirements/doc.txt file. Using pip is probably the easiest way to install these:

pip install -r requirements/doc.txt

The documentation is written for Sphinx in reStructuredText files in the docs/ directory. Documentation for each class and function is provided in the docstring in the code.

The documentation uses the Flask Sphinx theme. It is included as a git submodule of this project, rooted at docs/_themes. To get the themes, do

git submodule update --init

Now to build the documentation, run the command

python setup.py build_sphinx

in the top-level directory. The output can be viewed in a web browser by opening build/sphinx/html/index.html.

Contributing

Please report any issues on the GitHub Issue Tracker.

To suggest a change to the code or documentation, please create a new pull request on GitHub. Contributed code must come with an appropriate unit test. Please ensure that your code follows PEP8, by running, for example, flake8 before submitting a pull request. Also, please squash multiple commits into a single commit in your pull request by rebasing onto the master branch.

By contributing to this project, you are agreeing to license your code contributions under both the GNU Affero General Public License, either version 3 or any later version, and the 3-clause BSD License, and your documentation contributions under the Creative Commons Attribution-ShareAlike License version 4.0, as described in the copyright license section above.

Artwork

The artwork/flask-restless-small.svg and docs/_static/flask-restless-small.png are licensed under the Creative Commons Attribute-ShareAlike 4.0 license. The original image is a scan of a (now public domain) illustration by Arthur Hopkins in a serial edition of "The Return of the Native" by Thomas Hardy published in October 1878.

The artwork/flask-restless.svg and docs/_static/flask-restless.png are licensed under the Flask Artwork License.

Contact

Jeffrey Finkelstein [email protected]

Issues
  • Excluding Response Fields and Huge Performance Hits

    Excluding Response Fields and Huge Performance Hits

    Hey dudes,

    Love Flask-Restless, but wanted to leave an issue here as I'd love to use the library, but a showstopper in my use case (and possibly that of other people) is that Flask-Restless really has no way (currently) to properly exclude database relationship queries with the pre and postprocessor stuff.

    For instance, I have an application which has several models, namely:

    State and Person. Each person has a state relationship (via ForeignKey).

    My API clients need to frequently grab a list of all states in the system, so they'll do something like:

    GET /api/states

    And will immediately get their screen flooded with results (because Flask-Restless is traversing the backref and generating JSON for the millions of people in each state).

    Even if I were to explicitly write a postprocessor for the GET_MANY hook, this wouldn't really solve the problem as each request to my API endpoint /api/states would still result in Flask-Restless spending an enormous amount of time loading my people backref and eventually discarding that data and returning a response.

    I think a good solution to this problem is what issue #161 is suggesting: have Flask-Restless only load foreign key relationships when they're explicitly eagerly loaded by Flask-SQLAlchemy.

    I'm documenting this here for discussion purposes. Thank you.

    bug 
    opened by rdegges 25
  • Add Swagger support

    Add Swagger support

    https://developers.helloreverb.com/swagger/

    Flask peewee and mongodb currently support it. Swagger auto generates docs for your rest api.

    enhancement wontfix 
    opened by reubano 16
  • Add support custom serialization function

    Add support custom serialization function

    Hi Jeffrey

    In #139 you are remove custom code for specifying include and exclude columns, after that it is very inconvenient to include/exclude columns in postprocessor function (particularly in GET_MANY postprocessor).

    My suggestion is add new parameter "serialization_function" to create_api_blueprint and if this param is not None call this function instead of the _to_dict

    enhancement 
    opened by klinkin 15
  • Better approach (in my opinion) to AND/OR junctions

    Better approach (in my opinion) to AND/OR junctions

    The junction mechanism doesn't solve the nested and/or problem.

    Consider the query:

    SELECT *
    FROM table
    WHERE fld1='val1' 
      AND (fld2='val2' OR fld3='val3' OR (val4='val4' AND val5='val5')) 
      AND fld6='val6';
    

    The junction mechanism doesn't provide syntax to write it like a json filter. My method looks like an hack (because it's not intuitive) but works very well. It uses lists to group and apply the correct conjunction/disjunction. My implementation allow the WHERE part of the query to be written as:

    {
        "filters": [
            {"name":"fld1", "op":"eq", "val":"val1"},
            [
                {"name":"fld2", "op":"eq", "val":"val2"},
                {"name":"fld3", "op":"eq", "val":"val3"},
                [
                    {"name":"fld4", "op":"eq", "val":"val4"},
                    {"name":"fld5", "op":"eq", "val":"val5"}
                ]
            ],
            {"name":"fld6", "op":"eq", "val":"val6"}
        ]
    }
    

    As you can see the or / and junction is toggled on every new level.

    If you are interested in this approach I will write documentation and tests and submit and more clean pull request.

    enhancement 
    opened by franklx 14
  • Sorting and filtering on hybrid properties fails

    Sorting and filtering on hybrid properties fails

    I'm using flask_restless-1.0.0b2 and it seems that if I define a hybrid property like

        @hybrid_property
        def is_complete(self):
            """
            when all features are completed, this workorder should be completed
            """
            for f in self.features:
                if f.feature_status == 'Open':
                    return 'No'
            return 'Yes'
    
        @is_complete.expression
        def is_complete(cls):
            return select([Workorder_Feature.feature_status]).\
                    where(Workorder_Feature.workorder_id==cls.id)
    

    And I pass parameters like this:

    sort:is_complete
    

    or

    filter[objects]:[{"name":"is_complete","op":"like","val":"%No%"}]
    

    It throws errors in flask_restless\search\operators.py on line 98 https://github.com/jfinkels/flask-restless/blob/master/flask_restless/search/operators.py#L98: 'Select' has no attribute 'like'

    and in flask_restless\search\drivers.py on line 121 https://github.com/jfinkels/flask-restless/blob/master/flask_restless/search/drivers.py#L121: Select object has no attribute 'asc'

    invalid 
    opened by roemhildtg 14
  • Provide extension hooks in API class

    Provide extension hooks in API class

    I needed a way to extend and modify default Flask-Restless functionality and came up with this. Basically idea is such:

    • Before-action hooks allow more complex permission check and modifying/augmenting request
    • After-action hooks allow to modify response
    • Any extension hook can abort request or return a completely custom response

    I'm not yet entirely sure about API of these hooks. For instance with _before_post or _after_get is clear enough - pass the model about to be created in case of POST and pass model + its data in dict in case of GET.

    With _after_search, _before_patch, _after_patch is a bit more tricky. Now I think best approach is to pass along as much data as possible and let extending class make sense out of it.

    This also makes post_form_preprocessor from #74 obsolete.

    Here's some code from my project in progress (and more examples are in tests): https://gist.github.com/3155303

    This change would also allow to address #2 rather elegantly. E.g.: https://gist.github.com/3155322

    What do you think?

    enhancement 
    opened by mkuprionis 14
  • Ability To Specify Recursion Level

    Ability To Specify Recursion Level

    I noticed that by default Flask-Restless only returns one level of recursion on relationships. That is, a request to /api/model/ returns that models immediate attributes, the relationships and their immediate attributes, but does not return relationships on relationships or so forth.

    It's possible to make a second request to pull these, such as /api/model//relationship which will then give you that second level, but each one will require setting up additional requests.

    The main issue here is when we want to pull a big block of data and all the information we can on a model using asynchronous javascript, we have to code up several levels of asynchronous AJAX requests to get at the information. If we could specify how many levels of recursion we wanted with the first request, we could just get one big JSON blob in a single request containing all data. In my opinion, one much larger JSON blob may take longer to serve, but in a highly normalized database where there are many different joins and relationships going on, it'll be much preferred both for performance and coding (much fewer code to make a single AJAX call than multiple async calls, browsers tend to only send out 2-3 requests at once while waiting for responses, introducing latency as more and more ajax calls are stacked, etc).

    I realize that probably the primary concern here is with infinite loops being setup if back references exist. The easiest solution would be to simply leave those out and not include those relationships during the recursion, since the information will be available higher up in the JSON hierarchy.

    Also, depending on the amount of data and relationships for a given model, it could return more than is needed, so that is where a parameter specifying recursion level would be helpful.

    The alternative to pragmatically determining when a back reference occurs would be an option to allow users to explicitly specify which relationships should be recursed somewhere. For example, users add something like recurse_relations attribute to the SQLAlchemy model that specifies which relationships can be recursed safely. It makes the work of figuring it out automatically a little easier, but does require extra work on the users since they must specify which ones should automatically recurse.

    enhancement invalid 
    opened by rholloway 14
  • Explicit declaration of exposed sub-resources.

    Explicit declaration of exposed sub-resources.

    Enables explicit declaration of exposed model sub-resources by passing a relationname parameter to the APIManager.create_api method.

    This enables model relation endpoints to declare their own include and exclude rules, methods, and post and pre processors.

    If relationname is not passed to create_api, only the primary model endpoints are created (e.g. /api/person, /api/person/1) you won't be able to access other endpoints. Additional calls to create_api which include the relationname parameter create the relation endpoints and at this point include and exclude rules as well as post and pre processors can be passed (Same as the primary model or different).

    This also enables filtering of exposed relations using the same API.

    This introduces two backwards incompatible changes.

    1. Each exposed relation endpoint needs to be defined using create_api and passing the relationname parameter.

    2. When passing exclude_columns, if you wish to exclude all relational data in a field, you only need to pass the field name, and not each field under the relation. For example,

      exclude_columns = ['country']

      Instead of

      exclude_columns = ['country.name', 'country.code']

    This commit also updates the has_field doc string, which should also work for hybrid_property fields.

    An example declaration exposing a primary resource and a sub-resource:

    apimanager.create_api(Country,
            methods=methods,
            url_prefix="/api/v1",
            results_per_page=results_per_page,
            max_results_per_page=100000,
            postprocessors=postprocessors_,
            preprocessors=preprocessors_,
            allow_functions=allow_functions,
            exclude_columns=[],
            include_columns=[],
            validation_exceptions=[ValidationError,
                ProcessingException,
                BadRequest],
            )
    
    apimanager.create_api(Country,
            relationname='cities',
            methods=methods,
            url_prefix="/api/v1",
            results_per_page=results_per_page,
            max_results_per_page=100000,
            postprocessors=postprocessors_,
            preprocessors=preprocessors_,
            allow_functions=allow_functions,
            exclude_columns=[],
            include_columns=[],
            validation_exceptions=[ValidationError,
                ProcessingException,
                BadRequest],
            )
    
    opened by dnordberg 13
  • No way to do UPSERT using PUT

    No way to do UPSERT using PUT

    According to HTTP spec it is possible to create new resource by PUTting to its desired URI - http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6 :

    The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server. If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI.

    And it's not possible with flask-restless as it requires table row to be already present:

    # create a SQLAlchemy Query which has exactly the specified row
    query = query_by_primary_key(self.session, self.model, instid)
    if query.count() == 0:
        abort(404)
    
    enhancement wontfix 
    opened by qrilka 13
  • Fixes: #476 - Overriden primary key in links

    Fixes: #476 - Overriden primary key in links

    Hey, here's my solution for #476. I hope it's acceptable. If I've forgotten anything please let me know!

    All enabled tests are passing on the branch:

    [email protected]:~/work/flask-restless:overriden_primary_key_in_links  V $ py.test           (restless)
    ======================================= test session starts ========================================
    platform darwin -- Python 2.7.10, pytest-2.9.0, py-1.4.31, pluggy-0.3.1
    rootdir: /Users/awalton/work/flask-restless, inifile:
    collected 449 items
    
    tests/test_bulk.py sssssss
    tests/test_creating.py ..........................................ss..
    tests/test_deleting.py s............
    tests/test_fetching.py ............sss................................................s...
    tests/test_filtering.py s....................................................
    tests/test_functions.py .........
    tests/test_manager.py ......................s..
    tests/test_metadata.py s.
    tests/test_serialization.py ..................
    tests/test_updating.py .................................sssss..
    tests/test_updatingrelationship.py ..................................................
    tests/test_validation.py ............
    tests/test_jsonapi/test_creating_resources.py ........
    tests/test_jsonapi/test_deleting_resources.py ..
    tests/test_jsonapi/test_document_structure.py .....................
    tests/test_jsonapi/test_fetching_data.py ...............................................
    tests/test_jsonapi/test_server_responsibilities.py s......
    tests/test_jsonapi/test_updating_relationships.py ..........
    tests/test_jsonapi/test_updating_resources.py ............
    
    ============================= 426 passed, 23 skipped in 11.03 seconds ==============================
    
    bug 
    opened by kopf 13
  • query._limit is not anymore defined in sqlalchemy

    query._limit is not anymore defined in sqlalchemy

    flask_restless/views/helpers.py use query._limit who is not anymore a Query class method in sqlalchemy since 24 may 2021.

    opened by Cabu 1
  • How to use multiple DB users?

    How to use multiple DB users?

    In my flask restless file, I have a read user and a write user. Each has their own db session. This is basically what I'm trying to do at the moment:

    manager = flask_restless.APIManager(app, session=read_session)
    
    server = manager.create_api(Server, methods=["GET"])
    
    admin_manager = flask_restless.APIManager(app, session=write_session)
    
    server_admin = admin_manager.create_api(Server, collection_name='server_admin', methods=["GET","POST","PUT","PATCH","DELETE"])
    

    but am getting an error that says: "Flask-Restless has already been initialized on this application"

    I also tried this and it doesn't seem to work either

    manager = flask_restless.APIManager(app, session=read_session)
    
    server = manager.create_api(Server, methods=["GET"])
    
    manager.session = write_session
    
    server_admin = manager.create_api(Server, collection_name='server_admin', methods=["GET","POST","PUT","PATCH","DELETE"])
    
    
    opened by sscots 0
  • docs: Fix simple typo, representating -> representing

    docs: Fix simple typo, representating -> representing

    There is a small typo in flask_restless/search/operators.py.

    Should read representing rather than representating.

    opened by timgates42 0
  • Using flask-restless together with flask-api

    Using flask-restless together with flask-api

    Flask-restless looks excellent, but I really like the browsable API offered by flaskAPI. The ability to send PUT/POST requests directly from the browsable API instead of postman/curl/etc. is appealing.

    The issue is that the views that flask-restless returns out of the box are incompatible with what FlaskAPI expects, so FlaskAPI will ignore routes handled by flask-restless. See this comment from the FlaskAPI developer - https://github.com/flask-api/flask-api/issues/92

    What I'm hoping to find is some option (or small hack) for flask-restless that will make it return a list or dictionary instead of json/html, and FlaskAPI would then handle returning html or json depending on the content type requested. Is that possible with flask-restless? So far I haven't had any luck finding anything in the docs that looks relevant.

    Thanks in advance.

    opened by Madsn 0
  • Append to a list of objects

    Append to a list of objects

    In a table A that has a list of objects B, is it possible to append an object? The alternative would be to retrieve the list, add an object to it, and upload the modified list. The problem with this solution is that the local object A could become stale between the GET and the PATCH. Making the whole system inconsistent.

    opened by eliaperantoni 0
  • Fetch all objects to include in one query to improve performance

    Fetch all objects to include in one query to improve performance

    Using an include results in fetching every object individually, even when this is not necessary. This commit evaluates the given query and uses the resulting objects instead. If your data model is properly configured, the important objects will already be fetched in this query. This improves some of our endpoint time from > 1 minute to 1 second.

    opened by Cotix 1
  • Exception trying to jsonify decimal count

    Exception trying to jsonify decimal count

    I'm trying to use flask-restless against an Informix database. Informix returns a decimal type for count. For example, "select count(id) as c1 from users" would return c1 as Decimal('26'). Because of this, flask-restless throws an exception when trying to create the JSON of num_results. I'm finding this against the 0.17 version.

    Even though Informix returns a Decimal type for the count, it looks like it could be safely cast to an Int in the context of generating num_results. I see two possible files where this could be addressed: in the helpers.py in the count function the returns could be cast to int. Second option, and perhaps better, change views.py in the _pagination function where it looks up num_results = count... I added the cast as num_results = int(count...) in this file and that seems to fix the problem for Informix. It looks like the equivalent code for this is views/base.py in the 1.0.0 beta code. Based on skimming the code changes, this might be partially fixed by #363 when not using pagination, but the cast to int may still be helpful otherwise.

    Based on researching this problem, it sounds like Oracle databases can also return Decimal types for count.

    Tim

    opened by tpow 2
  • filtering with date on datetime field using le

    filtering with date on datetime field using le

    Name: Flask-Restless Version: 0.17.0

    I am getting wrong results while filtering.

    I have model defined like below:

    class Session(Base):
        ...
        start_time = Column(DateTime, nullable=False, default=get_current_utc_datetime)
        end_time = Column(DateTime, onupdate=get_current_utc_datetime)
        ...
    

    when I filter using simple date string api/session?q={"filters":[{"name":"start_time","op":"ge","val":"2018-10-19"},{"name":"end_time","op":"le","val":"2018-11-19"}]} I get 3 result. It does not include one result which has end_time "2018-11-19".

    However when I filter using datetime iso string api/session?q={"filters":[{"name":"start_time","op":"ge","val":"2018-10-19"},{"name":"end_time","op":"le","val":"2018-11-19T23:59:59.000Z"}]} It returns 4 result which is correct.

    It seems like edge case is not covered here when filtered using date.

    Edit: I also tried api/session?q={"filters":[{"name":"start_time","op":"ge","val":"2018-10-19"},{"name":"end_time","op":"le","val":"2018-11-20"}]} It returns 4 results.

    opened by Dushyant7 0
  • Flask 1.0.2 compatibility

    Flask 1.0.2 compatibility

    Flask 1.0.2 doesn't allow dots in Blueprint view functions since commit pallets/[email protected]

    As there are some view function names ended with .relationship, Flask-Restless breaks recent versions of Flask . I have changed this names and now they ends with _relationship. It seems to work with Flask 1.0.2. This solves #686.

    opened by damahou 9
Releases(0.3)
  • 0.3(Apr 15, 2016)

  • 0.4(Apr 15, 2016)

    • Added Python 2.5 and Python 2.6 support.
    • Allow users to specify which HTTP methods for a particular API will require authentication and how that authentication will take place.
    • Created base classes for test cases.
    • Moved the evaluate_functions function out of the flask_restless.search module and corrected documentation about how function evaluation works.
    • Added allow_functions keyword argument to flask_restless.APIManager.create_api.
    • Fixed bug where we weren't allowing PUT requests in flask.ext.restless.manager.APIManager.create_api.
    • Added collection_name keyword argument to flask_restless.APIManager.create_api to allow user provided names in URLs.
    • Added allow_patch_many keyword argument to flask_restless.APIManager.create_api to allow enabling or disabling the PATCH many functionality.
    • Disable the PATCH many functionality by default.
    Source code(tar.gz)
    Source code(zip)
    flask-restless-0.4.tar.gz.asc(473 bytes)
  • 0.5(Apr 15, 2016)

    • Dual-licensed under GNU AGPLv3+ and 3-clause BSD license.
    • Added capturing of exceptions raised during field validation.
    • Added examples/separate_endpoints.py, showing how to create separate API endpoints for a single model.
    • Added include_columns keyword argument to flask_restless.APIManager.create_api method to allow users to specify which columns of the model are exposed in the API.
    • Replaced Elixir with Flask-SQLAlchemy. Flask-Restless now only supports Flask-SQLAlchemy.
    Source code(tar.gz)
    Source code(zip)
    flask-restless-0.5.tar.gz.asc(473 bytes)
  • 0.6(Apr 15, 2016)

    • Added support for accessing model instances via arbitrary primary keys, instead of requiring an integer column named id.
    • Added example which uses curl as a client.
    • Added support for pagination of responses.
    • Fixed issue due to symbolic link from README to README.md when running pip bundle foobar Flask-Restless.
    • Separated API blueprint creation from registration, using APIManager.create_api and APIManager.create_api_blueprint.
    • Added support for pure SQLAlchemy in addition to Flask-SQLAlchemy.
    • #74: Added post_form_preprocessor keyword argument to APIManager.create_api.
    • #77: validation errors are now correctly handled on PATCH requests.
    Source code(tar.gz)
    Source code(zip)
    flask-restless-0.6.tar.gz.asc(473 bytes)
  • 0.7.0(Apr 15, 2016)

    • Added working include and exclude functionality to the views._to_dict function.
    • Added exclude_columns keyword argument to APIManager.create_api.
    • #79: attempted to access attribute of None in constructor of APIManager.
    • #83: allow POST requests with one-to-one related instances.
    • #86: allow specifying include and exclude for related models.
    • #91: correctly handle POST requests to nullable sqlalchemy.DateTime columns.
    • #93: Added a total_pages mapping to the JSON response.
    • #98: GET requests to the function evaluation endpoint should not have a data payload.
    • #101: exclude in views._to_dict function now correctly excludes requested fields from the returned dictionary.
    Source code(tar.gz)
    Source code(zip)
    flask-restless-0.7.0.tar.gz.asc(473 bytes)
  • 0.8.0(Apr 15, 2016)

  • 0.9.0(Apr 15, 2016)

    • Removed ability to provide a sqlalchemy.orm.session.Session class when initializing APIManager; provide an instance of the class instead.
    • Changes some dynamically loaded relationships used for testing and in examples to be many-to-one instead of the incorrect one-to-many. Versions of SQLAlchemy after 0.8.0b2 raise an exception when the latter is used.
    • #105: added ability to set a list of related model instances on a model.
    • #107: server responds with an error code when a PATCH or POST request specifies a field which does not exist on the model.
    • #108: dynamically loaded relationships should now be rendered correctly by the views._to_dict function regardless of whether they are a list or a single object.
    • #109: use sphinxcontrib-issuetracker to render links to GitHub issues in documentation.
    • #110: enable results_per_page query parameter for clients, and added max_results_per_page keyword argument to APIManager.create_api.
    • #114: fix bug where string representations of integers were converted to integers.
    • #117: allow adding related instances on PATCH requests for one-to-one relationships.
    • #123: PATCH requests to instances which do not exist result in a 404 response.
    Source code(tar.gz)
    Source code(zip)
    flask-restless-0.9.0.tar.gz.asc(473 bytes)
  • 0.9.1(Apr 15, 2016)

  • 0.9.2(Apr 15, 2016)

  • 0.9.3(Apr 15, 2016)

  • 0.10.0(Apr 15, 2016)

    • #2: adds basic GET access to one level of relationship depth for models.
    • #113: interpret empty strings for date fields as None objects.
    • #115: use Python's built-in assert statements for testing
    • #128: allow disjunctions when filtering search queries.
    • #130: documentation and examples now more clearly show search examples.
    • #135: added support for hybrid properties.
    • #139: remove custom code for authentication in favor of user-defined pre- and postprocessors (this supercedes the fix from #154`).
    • #141: relax requirement for version of python-dateutil to be not equal to 2.0 if using Python version 2.6 or 2.7.
    • #146: preprocessors now really execute before other code.
    • #148: adds support for SQLAlchemy association proxies.
    • #154 (this fix is irrelevant due to #139): authentication function now may raise an exception instead of just returning a Boolean.
    • #157: POST requests now receive a response containing all fields of the created instance.
    • #162: allow pre- and postprocessors to indicate that no change has occurred.
    • #164, #172, #173: PATCH requests update fields on related instances.
    • #165: fixed bug in automatic exposing of URLs for related instances.
    • #170: respond with correct HTTP status codes when a query for a single instance results in none or multiple instances.
    • #174: allow dynamically loaded relationships for automatically exposed URLs of related instances.
    • #176: get model attribute instead of column name when getting name of primary key.
    • #182: allow POST requests that set hybrid properties.
    • #152: adds some basic server-side logging for exceptions raised by views.
    Source code(tar.gz)
    Source code(zip)
    flask-restless-0.10.0.tar.gz.asc(473 bytes)
  • 0.10.1(Apr 14, 2016)

  • 0.11.0(Apr 14, 2016)

    • Requests that require a body but don't have Content-Type: application/json will cause a 415 response.
    • Responses now have Content-Type: application/json.
    • #180: allow more expressive has and any searches.
    • #195: convert UUID objects to strings when converting an instance of a model to a dictionary.
    • #202: allow setting hybrid properties with expressions and setters.
    • #203: adds the include_methods keyword argument to APIManager.create_api, which allows JSON responses to include the result of calling arbitrary methods of instances of models.
    • #204, #205: allow parameters in Content-Type header.
    Source code(tar.gz)
    Source code(zip)
    flask-restless-0.11.0.tar.gz.asc(473 bytes)
  • 0.12.0(Apr 14, 2016)

    • #188: provides metadata as well as normal data in JSONP responses.
    • #193: allows DELETE requests to related instances.
    • #215: removes Python 2.5 tests from Travis configuration.
    • #216: don't resolve Query objects until pagination function.
    • #217: adds missing indices in format string.
    • #220: fix bug when checking attributes on a hybrid property.
    • #227: allows client to request that the server use the current date and/or time when setting the value of a field.
    • #228 (as well as #212, #218, #231): fixes issue due to a module removed from Flask version 0.10.
    Source code(tar.gz)
    Source code(zip)
    flask-restless-0.12.0.tar.gz.asc(473 bytes)
  • 0.12.1(Apr 14, 2016)

    • #222: on POST and PATCH requests, recurse into nested relations to get or create instances of related models.
    • #246: adds pysqlite to test requirements.
    • #260: return a single object when making a GET request to a relation sub-URL.
    • #264: all methods now execute postprocessors after setting headers.
    • #265: convert strings to dates in related models when making POST requests.
    Source code(tar.gz)
    Source code(zip)
    flask-restless-0.12.1.tar.gz.asc(473 bytes)
  • 0.13.0(Apr 14, 2016)

    • Allows universal preprocessors or postprocessors; see "Universal processors" section of the documentation.
    • Allows specifying which primary key to use when creating endpoint URLs.
    • Requires SQLAlchemy version 0.8 or greater.
    • #17: use Flask's flask.Request.json to parse incoming JSON requests.
    • #29: replace custom jsonify_status_code function with built-in support for return jsonify(), status_code style return statements (new in Flask 0.9).
    • #51: Use mimerender to render dictionaries to JSON format.
    • #247: adds support for making POST requests to dictionary-like association proxies.
    • #249: returns 404 if a search reveals no matching results.
    • #254: returns 404 if no related field exists for a request with a related field in the URL.
    • #256: makes search parameters available to postprocessors for GET and PATCH requests that access multiple resources.
    • #263: Adds Python 3.3 support; drops Python 2.5 support.
    • #267: Adds compatibility for legacy Microsoft Internet Explorer versions 8 and 9.
    • #270: allows the query attribute on models to be a callable.
    • #282: order responses by primary key if no order is specified.
    • #284: catch DataError and ProgrammingError exceptions when bad data are sent to the server.
    • #286: speed up paginated responses by using optimized count() function.
    • #293: allows sqlalchemy.Time fields in JSON responses.
    Source code(tar.gz)
    Source code(zip)
    flask-restless-0.13.0.tar.gz.asc(473 bytes)
  • 0.13.1(Apr 14, 2016)

  • 0.14.0(Apr 14, 2016)

    • Fixes bug where primary key specified by user was not being checked in some POST requests and some search queries.
    • #223: documents CORS example.
    • #280: don't expose raw SQL in responses on database errors.
    • #299: show error message if search query tests for NULL using comparison operators.
    • #315: check for query object being None.
    • #324: DELETE should only return 204 if something is actually deleted.
    • #325: support null inside has search operators.
    • #328: enable automatic testing for Python 3.4.
    • #333: enforce limit in helpers.count.
    • #338: catch validation exceptions when attempting to update relations.
    • #339: use user-specified primary key on PATCH requests.
    • #344: correctly encodes Unicode fields in responses.
    Source code(tar.gz)
    Source code(zip)
    flask-restless-0.14.0.tar.gz.asc(473 bytes)
  • 0.14.1(Apr 14, 2016)

  • 0.14.2(Apr 14, 2016)

  • 0.15.0(Apr 14, 2016)

    • #320: detect settable hybrid properties instead of raising an exception.
    • #350: allows exclude/include columns to be specified as SQLAlchemy column objects in addition to strings.
    • #356: rollback the SQLAlchemy session on a failed patch request.
    • #368: adds missing documentation on using custom queries (see the "Custom queries" section of the documentation)
    Source code(tar.gz)
    Source code(zip)
    flask-restless-0.15.0.tar.gz.asc(473 bytes)
  • 0.15.1(Apr 14, 2016)

  • 0.16.0(Apr 14, 2016)

    • #237: allows bulk delete of model instances via the allow_delete_many keyword argument.
    • #313, #389: APIManager.init_app now can be correctly used to initialize multiple Flask applications.
    • #327, #391: allows ordering searches by fields on related instances.
    • #353: allows search queries to specify group_by directives.
    • #365: allows preprocessors to specify return values on get requests.
    • #385: makes the include_methods keywords argument respect model properties.
    Source code(tar.gz)
    Source code(zip)
    flask-restless-0.16.0.tar.gz.asc(473 bytes)
  • 0.17.0(Apr 14, 2016)

    • Corrects bug to allow delayed initialization of multiple Flask applications.
    • #167: allows custom serialization/deserialization functions.
    • #198: allows arbitrary Boolean expressions in search query filters.
    • #226: allows creating APIs before initializing the Flask application object.
    • #274: adds the url_for function for computing URLs from models.
    • #379: improves datetime parsing in search requests.
    • #398: fixes bug where DELETE_SINGLE processors were not actually used.
    • #400: disallows excluding a primary key on a POST request.
    Source code(tar.gz)
    Source code(zip)
    flask-restless-0.17.0.tar.gz.asc(473 bytes)
  • 1.0.0b1(Apr 14, 2016)

    This is a beta release; these changes will appear in the 1.0.0 release.

    • #255 adds support for filtering by PostgreSQL network operators.
    • #257: ensures additional attributes specified by the user actually exist on the model.
    • #363 (partial solution): don't use COUNT on requests that don't require pagination.
    • #404: Major overhaul of Flask-Restless to support JSON API.
    • Increases minimum version requirement for python-dateutil to be strictly greater than 2.2 to avoid parsing bug.
    • #331, #415: documents the importance of URL encoding when using the like operator to filter results.
    • #376: add a not_like operator for filter objects.
    • #431: adds a url_prefix keyword argument to the :class:APIManager constructor, so one can specify a URL prefix once for all created APIs.
    • #449: roll back the session on any SQLAlchemy error, not just a few.
    • #432, #462: alias relation names when sorting by multiple attributes on a relationship.
    • #436, #453: use __table__.name instead of __tablename__ to infer the collection name for the SQLAlchemy model.
    • #440, #475: uses the serialization function provided at the time of invoking APIManager.create_api to serialize each resource correctly, depending on its type.
    • #474: include license files in built wheel for distribution.
    • #501: allows empty string for url_prefix keyword argument to APIManager.create_api.
    • #476: use the primary key provided at the time of invoking APIManager.create_api to build resource urls in responses.
    Source code(tar.gz)
    Source code(zip)
    flask-restless-1.0.0b1.tar.gz.asc(473 bytes)
Flask-Potion is a RESTful API framework for Flask and SQLAlchemy, Peewee or MongoEngine

Flask-Potion Description Flask-Potion is a powerful Flask extension for building RESTful JSON APIs. Potion features include validation, model resource

DTU Biosustain 482 Nov 23, 2021
Flask-Potion is a RESTful API framework for Flask and SQLAlchemy, Peewee or MongoEngine

Flask-Potion Description Flask-Potion is a powerful Flask extension for building RESTful JSON APIs. Potion features include validation, model resource

DTU Biosustain 484 Feb 3, 2021
Chisel is a light-weight Python WSGI application framework built for creating well-documented, schema-validated JSON web APIs

chisel Chisel is a light-weight Python WSGI application framework built for creating well-documented, schema-validated JSON web APIs. Here are its fea

Craig Hobbs 2 Oct 1, 2021
Embrace the APIs of the future. Hug aims to make developing APIs as simple as possible, but no simpler.

Read Latest Documentation - Browse GitHub Code Repository hug aims to make developing Python driven APIs as simple as possible, but no simpler. As a r

Hug API Framework 6.6k Nov 27, 2021
Flask Sugar is a web framework for building APIs with Flask, Pydantic and Python 3.6+ type hints.

Flask Sugar is a web framework for building APIs with Flask, Pydantic and Python 3.6+ type hints. check parameters and generate API documents automatically. Flask Sugar是一个基于flask,pyddantic,类型注解的API框架, 可以检查参数并自动生成API文档

null 60 Nov 29, 2021
Otter is framework for creating microservices in Flask like fassion using RPC communication via message queue.

Otter Framework for microservices. Overview Otter is framework for creating microservices in Flask like fassion using RPC communication via message qu

Volodymyr Biloshytskyi 3 Oct 13, 2021
Restful API framework wrapped around MongoEngine

Flask-MongoRest A Restful API framework wrapped around MongoEngine. Setup from flask import Flask from flask_mongoengine import MongoEngine from flask

Close 517 Nov 28, 2021
Restful API framework wrapped around MongoEngine

Flask-MongoRest A Restful API framework wrapped around MongoEngine. Setup from flask import Flask from flask_mongoengine import MongoEngine from flask

Close 505 Feb 11, 2021
An abstract and extensible framework in python for building client SDKs and CLI tools for a RESTful API.

django-rest-client An abstract and extensible framework in python for building client SDKs and CLI tools for a RESTful API. Suitable for APIs made wit

Certego 2 Oct 22, 2021
You can use the mvc pattern in your flask application using this extension.

You can use the mvc pattern in your flask application using this extension. Installation Run the follow command to install mvc_flask: $ pip install mv

Marcus Pereira 20 Nov 21, 2021
Daniel Vaz Gaspar 3.6k Nov 23, 2021
Pyrin is an application framework built on top of Flask micro-framework to make life easier for developers who want to develop an enterprise application using Flask

Pyrin A rich, fast, performant and easy to use application framework to build apps using Flask on top of it. Pyrin is an application framework built o

Mohamad Nobakht 7 Nov 15, 2021
Web APIs for Django. 🎸

Django REST framework Awesome web-browsable Web APIs. Full documentation for the project is available at https://www.django-rest-framework.org/. Fundi

Encode 22.3k Nov 25, 2021
Web3.py plugin for using Flashbots' bundle APIs

This library works by injecting a new module in the Web3.py instance, which allows submitting "bundles" of transactions directly to miners. This is done by also creating a middleware which captures calls to eth_sendBundle and eth_callBundle, and sends them to an RPC endpoint which you have specified, which corresponds to mev-geth.

Georgios Konstantopoulos 118 Nov 21, 2021
Web3.py plugin for using Flashbots' bundle APIs

This library works by injecting a new module in the Web3.py instance, which allows submitting "bundles" of transactions directly to miners. This is do

Flashbots 121 Dec 1, 2021
A Python package to easily create APIs in Python.

API_Easy An Python Package for easily create APIs in Python pip install easy-api-builder Requiremnets: <= python 3.6 Required modules --> Flask Docume

Envyre-Coding 2 Nov 9, 2021
Goblet is an easy-to-use framework that enables developers to quickly spin up fully featured REST APIs with python on GCP

GOBLET Goblet is a framework for writing serverless rest apis in python in google cloud. It allows you to quickly create and deploy python apis backed

Austen 31 Nov 23, 2021
Containers And REST APIs Workshop

Containers & REST APIs Workshop Containers vs Virtual Machines Ferramentas Podman: https://podman.io/ Docker: https://www.docker.com/ IBM CLI: https:/

Vanderlei Munhoz 7 Nov 4, 2021
Flask + Docker + Nginx + Gunicorn + MySQL + Factory Method Pattern

This Flask project is reusable and also an example of how to merge Flask, Docker, Nginx, Gunicorn, MySQL, new: Flask-RESTX, Factory Method design pattern, and other optional dependencies such as Dynaconf, Marshmallow, SQLAlchemy, Faker, PyMySQL, Pytest, etc... which are installed inside the virtual environment "env_flask".

Facundo Padilla 19 Sep 19, 2021