Skip to main content

async-postgres-watcher

tests PyPI - Version PyPI - Wheel PyPI - Downloads PyPI - License Discord

Async Casbin PostgreSQL watcher to be used for monitoring updates to Casbin policies.

Installation

pip install casbin-async-postgres-watcher

Basic Usage Example

With Flask-authz

from flask_authz import CasbinEnforcer
from async_postgres_watcher import AsyncPostgresWatcher
from flask import Flask
from casbin.persist.adapters import FileAdapter

casbin_enforcer = CasbinEnforcer(app, adapter)

watcher = AsyncPostgresWatcher(host=HOST, port=PORT, user=USER, password=PASSWORD, dbname=DBNAME)
watcher.set_update_callback(casbin_enforcer.e.load_policy)

casbin_enforcer.set_watcher(watcher)

Basic Usage Example With SSL Enabled

See asyncpg documentation for full details of SSL parameters.

With Flask-authz

from flask_authz import CasbinEnforcer
from async_postgres_watcher import AsyncPostgresWatcher
from flask import Flask
from casbin.persist.adapters import FileAdapter

casbin_enforcer = CasbinEnforcer(app, adapter)

# If check_hostname is True, the SSL context is created with sslmode=verify-full.
# If check_hostname is False, the SSL context is created with sslmode=verify-ca.
watcher = AsyncPostgresWatcher(host=HOST, port=PORT, user=USER, password=PASSWORD, dbname=DBNAME, sslrootcert=SSLROOTCERT, check_hostname = True, sslcert=SSLCERT, sslkey=SSLKEY)
watcher.set_update_callback(casbin_enforcer.e.load_policy)

casbin_enforcer.set_watcher(watcher)

Getting Help

License

This project is under Apache 2.0 License. See the LICENSE file for the full license text.

Metadata

Release files for casbin-async-postgres-watcher 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for casbin-async-postgres-watcher 1.4.0
File Size Uploaded
casbin_async_postgres_watcher-1.4.0.tar.gz 7.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for casbin-async-postgres-watcher 1.4.0
File Interpreter ABI Platform
casbin_async_postgres_watcher-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.2 kB

Release files / casbin_async_postgres_watcher-1.4.0.tar.gz

Download URL casbin_async_postgres_watcher-1.4.0.tar.gz
Size 7.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ace1e2b60f33913b1beab9f599772133a6c927140f094fe6f143a5bbe3ad19fc
BLAKE2b-256 checksum
How to use checksums
c66b65ffefcc8332b1e43bb9d91c9cbe36a6183fd8b8a7d61a864481fba1cdee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / casbin_async_postgres_watcher-1.4.0-py3-none-any.whl

Download URL casbin_async_postgres_watcher-1.4.0-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f50bec64676e2a94c9809938cf2bbe178213225bc7e0c2b0a74a473c75eb751
BLAKE2b-256 checksum
How to use checksums
66b51b04c17bc3847c89c327516e3830868373861e3c47b9016b1cae71c04ab3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

1.4.0 This release

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page