Skip to main content

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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

floowguard-0.1.2-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

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

Hashes for floowguard-0.1.2.tar.gz
Algorithm Hash digest
SHA256 abec60b399fa6e04782fde150f60df155b3ae672247afc916657d763feee2242
MD5 75cb1aab61ebb04cad0751a0317428ca
BLAKE2b-256 4b77e09cf791b293bed58c23e8cde582fbb94f042002798f6dfbe459c3997aab

See more details on using hashes here.

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

Hashes for floowguard-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 04f9fc1f2cbb03170b09ff04de789c5c319d593b030e572f4fcd8125225b3594
MD5 6cf64bcb77408b449ccb343e5d1dc739
BLAKE2b-256 d3ab9ef6b7e14177c2a51b3c700d6b125ae1a2414ba40d14b7f39caf9ccdd5bb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page