Python client SDK for the Floowguard policy engine
Project description
Floowguard Python SDK
A minimal Python client for the Floowguard policy engine, mirroring the official Node.js SDK interface.
Installation
Install the published package from PyPI:
pip install floowguard
This will also install the required requests dependency.
Usage
import os
from floowguard import FloowGuardApiClient
application_id = os.environ["FLOOWGUARD_APPLICATION_ID"]
client = FloowGuardApiClient(application_id)
identifier = "ACCOUNT_ID_OR_USER_ID"
# Check if this action should be allowed
allowed = client.has_access(
policy_name="POST_CREATION_LIMIT_EXAMPLE",
value=identifier,
)
if not allowed:
raise RuntimeError("You reached your limit for post creation for today. Try tomorrow.")
# Record the successful action and get the latest count
result = client.increment_and_get_policy_count(
policy_name="POST_CREATION_LIMIT_EXAMPLE",
value=identifier,
)
print("Current decision:", result.get("response"))
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
floowguard-0.1.2.tar.gz
(3.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file floowguard-0.1.2.tar.gz.
File metadata
- Download URL: floowguard-0.1.2.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abec60b399fa6e04782fde150f60df155b3ae672247afc916657d763feee2242
|
|
| MD5 |
75cb1aab61ebb04cad0751a0317428ca
|
|
| BLAKE2b-256 |
4b77e09cf791b293bed58c23e8cde582fbb94f042002798f6dfbe459c3997aab
|
File details
Details for the file floowguard-0.1.2-py3-none-any.whl.
File metadata
- Download URL: floowguard-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04f9fc1f2cbb03170b09ff04de789c5c319d593b030e572f4fcd8125225b3594
|
|
| MD5 |
6cf64bcb77408b449ccb343e5d1dc739
|
|
| BLAKE2b-256 |
d3ab9ef6b7e14177c2a51b3c700d6b125ae1a2414ba40d14b7f39caf9ccdd5bb
|