Metadata-Version: 2.1
Name: tenantpy
Version: 1.0.3
Summary: Tenant Management For Web Application
Home-page: UNKNOWN
Author: zhouhao
Author-email: zhouhao19931002@hotmail.com
Maintainer: zhouhao
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3.7
Requires-Python: >=3.7.0
Description-Content-Type: text/markdown
Requires-Dist: py-spy (==0.3.3)
Requires-Dist: dbutils (==2.0)
Requires-Dist: peewee (==3.9.3)
Requires-Dist: pymysql (==0.9.2)
Requires-Dist: pympler (==0.9)
Requires-Dist: redis (==3.2.1)
Requires-Dist: flask (==1.0.2)
Requires-Dist: jaeger-client (==4.3.0)

Tenant Management For Web Application
====
* Database Tenant Isolation
* Cache Tenant Isolation
* Customize Addons Tenant Meta Data Inject

e.g:
```
import flask
from flask import Flask
import json
import peewee

from tenantpy.contrib import flask as flask_tenc

app = Flask(__name__)

class User(flask_tenc.BaseModel):
    englishName = peewee.CharField()
    email = peewee.CharField()


class ConfigManager(flask_tenc.ConfigManager):

    def get_config(self, key: flask_tenc.ConfigKeys):
        # get config by any


@app.route("/random")
def random_pet():
    """A cute furry animal endpoint.
    ---
    get:
      description: Get a random pet
      security:
        - ApiKeyAuth: []
      responses:
        200:
          description: Return a pet
          content:
            application/json:
              schema: PetSchema
    """
    # Hardcoded example data
    flask.g.database.begin()
    ins = User.get()
    flask.g.database.rollback()
    pet_data = {
        "name": ins.englishName,
    }
    return flask.Response(json.dumps(pet_data), content_type="application/json")


flask_tenc.init_app(app, ConfigManager())
app.run()

```

