SQL Store for the API Billing Backend
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file frappysqlapibilling-0.1.0.tar.gz
.
File metadata
- Download URL: frappysqlapibilling-0.1.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf20607a09ac614ddbd2b8d87a09818aafe638c87f3db2a18a61649991f55c88 |
|
MD5 | 712c6fcf6c9be35d956dc8d7cac7d9d8 |
|
BLAKE2b-256 | 549ce02b06f19461676fac462d788b7a544f37962bf80a5c90b814a662a351e0 |
File details
Details for the file frappysqlapibilling-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: frappysqlapibilling-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 172a2c567ad870c25bcb31da705a90b927fe450fa394fa6ab2acd22889d22774 |
|
MD5 | eb1ad059ecdd3fb94a24f645d42d7b06 |
|
BLAKE2b-256 | 3238b22d228dc4876cc4de567d353036c020514783a7418b95dd85e0b8be749a |