Skip to main content

package flask to use conveniently like django

Project description

Flask Api Resource

package flask to use conveniently like django

Usage

Step 1

from flask import Flask
from flask_api_resource import FlaskApiResource

app = Flask(__name__)
app.config['INSTALL_APPS'] = []  # your application app like user
api = FlaskApiResource()
api.init_app(app=app)  # this can auto scan your resource

Step 2

According to your logic to create different app

user
    __init__.py
    apis
        user.py
# user.py
from flask_api_resource.api import BaseResource
from flask_api_resource.decorator import get

class UserResource(BaseResource):
    
    def get_urls(self):
        return [
            ('/detail', self.detail)
        ]
    
    @get
    def detail(self):
        return self.success({'id': 1})
# __init__.py

def register(api):
    from .apis.user import UserResource
    api.register(UserResource)

Step 3

run the Flask app server and open the http://127.0.0.1:5000/rest/user/detail

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask-api-resource-0.1.2.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file flask-api-resource-0.1.2.tar.gz.

File metadata

  • Download URL: flask-api-resource-0.1.2.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for flask-api-resource-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6eeddbe47a4fffacfe16a762dfd9c3720b30c19a41adccae373b7b3a91b1a13c
MD5 2698c89fd4eb21966b47ebe03751a7e3
BLAKE2b-256 3b7ff9017ec4d966adee6d2058a60d8293595ca5f45ce5518df9712f7905e524

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page