Skip to main content

No project description provided

Project description

Flaskerk

Build Status GitHub PyPI - Python Version

Provide OpenAPI document and validation for flask service.

Mainly built for Machine Learning Model services.

Features

Quick Start

install with pip install flaskerk (Python 3.6+)

from typing import List
from flask import Flask, request
from flaskerk import Flaskerk
from pydantic import BaseModel

class Query(BaseModel):
    name: str
    uid: str
    limit: int = 5

class Response(BaseModel):
    users: List[str]

app = Flask(__name__)
api = Flaskerk(app)

@app.route('/api/recommend', methods=['POST'])
@api.validate(query=Query, resp=Response)
def recommend():
    # algorithm here
    user = request.query
    print(user.name, user.uid)
    return Response(users=['xxx'] * user.limit)

if __name__ == '__main__':
    app.run()

try it with http POST :5000/api/recommend name='hello' uid='uuuuu' or curl -X POST -H "Content-Type: application/json" -d '{"name"="hello", "uid"="uuuuu"}' http://127.0.0.1:5000/api/recommend

Open the docs in http://127.0.0.1:5000/docs .

For more examples, check examples.

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

flaskerk-0.2.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

flaskerk-0.2.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file flaskerk-0.2.0.tar.gz.

File metadata

  • Download URL: flaskerk-0.2.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for flaskerk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3ea1658ea88feec0eb5f0a12ff276ea2461377860938cfaf939d4f5a9ff5e7e4
MD5 972310872d35b81935e3c3f6f1122514
BLAKE2b-256 93daf0be66d3938d7d92c17aa55f1a38a52937c864ffa658b1d1ab796d0a7192

See more details on using hashes here.

File details

Details for the file flaskerk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: flaskerk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for flaskerk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db23d5017c3c2086ae6a45b921e145b0a552d0943d80c64f1df325f37403ee70
MD5 0685d6e470eca3c5b3d94ac5c1118807
BLAKE2b-256 33cab2254e9251e92d06f05abaa2be6f188d38e1841d262179cb4eced9344120

See more details on using hashes here.

Supported by

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