Skip to main content

No project description provided

Project description

Flaskerk

Provide OpenAPI document and validation for flask service.

Mainly built for Machine Learning Model services.

Features

  • JSON data(request&response) validation with pydantic
  • Redoc UI
  • OpenAPI spec
  • Swagger UI
  • support flask url path validation

Quick Start

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
    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'

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.1.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

flaskerk-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flaskerk-0.1.0.tar.gz
  • Upload date:
  • Size: 3.8 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.1.0.tar.gz
Algorithm Hash digest
SHA256 43cbaeaa68e17fa1333e65deb2f5e99caab2c9af36562a8a42e55285e35b2c68
MD5 24a70531c0b967cd29a7ade11b789855
BLAKE2b-256 6112e5d9a6884337d8e938b4630a81025581541d5104165e9e827d7557404fba

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flaskerk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b328ef6481e1084518bf03a9d614bbf32548d1b3b1745e2e52fc32234d00670f
MD5 80ce4d29b958086f7c96f56916ea1486
BLAKE2b-256 521892a17029f16e76fa438659704b94de9bae267f064ca9a8a2f52c65fc162f

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