frappysqlapibilling-0.1.0
توضیحات
SQL Store for the API Billing Backend
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | frappysqlapibilling-0.1.0 |
| نام | frappysqlapibilling |
| نسخه کتابخانه | 0.1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Peter Ilfrich |
| ایمیل نویسنده | das-peter@gmx.de |
| آدرس صفحه اصلی | https://github.com/ilfrich/frappy-py-sql-api-billing-store |
| آدرس اینترنتی | https://pypi.org/project/frappysqlapibilling/ |
| مجوز | - |
# Frappy Python SQL Store for API Billing
Python SQLAlchemy Store Implementation for Tracking [API Billing](https://github.com/ilfrich/frappy-api-billing) Usage.
## Usage
```python
from frappysqlapibilling import UsageStore
from frappyapibilling import ApiBilling
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
# create flask app
app = Flask(__name__)
# create SQL DB connection
sql_host, sql_port, sql_user, sql_pass, sql_db = ...
sql_connect_str = f"{sql_user}:{sql_pass}@{sql_host}:{sql_port}/{sql_db}"
# example for postgres
app.config["SQLALCHEMY_DATABASE_URI"] = f"postgresql+psycopg2://{sql_connect_str}"
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
# create db
sql_db = SQLAlchemy(app)
# create sql store
store = UsageStore(sql_db=sql_db, table_name="api_billing_usage") # table name defaults to "api_billing_usage"
# pass the store instance to the api billing constructor
api_billing = ApiBilling(usage_store=store)
```
See [API Billing Usage](https://github.com/ilfrich/frappy-api-billing#usage) for details on how to use the module.
نیازمندی
| مقدار | نام |
|---|---|
| - | frappyapibilling |
| - | flask-sqlalchemy |
| - | sqlalchemy |
نحوه نصب
نصب پکیج whl frappysqlapibilling-0.1.0:
pip install frappysqlapibilling-0.1.0.whl
نصب پکیج tar.gz frappysqlapibilling-0.1.0:
pip install frappysqlapibilling-0.1.0.tar.gz