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 Node.js SDK interface.

Installation

This package depends on requests:

pip install requests

(If you package this as a library, include requests in your own dependency metadata.)

Usage

import os
from flowguard import FlowGuardApiClient

application_id = os.environ["FLOOWGUARD_APPLICATION_ID"]
client = FlowGuardApiClient(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.0.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.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file floowguard-0.1.0.tar.gz.

File metadata

  • Download URL: floowguard-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 04bb677733dbf691984d1809b16f28aa0341f48c2d905648530e7a7cc336d178
MD5 c5c3d026ac2aafb4b89d2f6c4d5c5eb1
BLAKE2b-256 71f3f2a66af236c10bfd02879fea76d6a3c7eb4c737349454fbc25223e44f6a9

See more details on using hashes here.

File details

Details for the file floowguard-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: floowguard-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff3d210e9da968bb11b897ebcea865dedab57060406b1ab8ca863c3bf6cbfdd4
MD5 f19685ddbe35cbce4bb2baebaa43feb3
BLAKE2b-256 3407da14806f6f45e40bca48a8452fae06ab2827fde2c009c71ab6f65eef7d4b

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