Frappy Python SQL Store for API Billing
Python SQLAlchemy Store Implementation for Tracking API Billing Usage.
Usage
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 for details on how to use the module.
Release files for frappysqlapibilling 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| frappysqlapibilling-0.1.0.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| frappysqlapibilling-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.5 kB
Release files / frappysqlapibilling-0.1.0.tar.gz
| Download URL | frappysqlapibilling-0.1.0.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf20607a09ac614ddbd2b8d87a09818aafe638c87f3db2a18a61649991f55c88
|
|
BLAKE2b-256 checksum How to use checksums |
549ce02b06f19461676fac462d788b7a544f37962bf80a5c90b814a662a351e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.11
|
Release files / frappysqlapibilling-0.1.0-py3-none-any.whl
| Download URL | frappysqlapibilling-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
172a2c567ad870c25bcb31da705a90b927fe450fa394fa6ab2acd22889d22774
|
|
BLAKE2b-256 checksum How to use checksums |
3238b22d228dc4876cc4de567d353036c020514783a7418b95dd85e0b8be749a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.11
|