Skip to main content

redis-watcher

GitHub Action Coverage Status Version PyPI - Wheel Pyversions Download Discord

redis-watcher is the Redis watcher for pycasbin. With this library, Casbin can synchronize the policy with the database in multiple enforcer instances.

Installation

pip install casbin-redis-watcher

Simple Example

import os
import casbin
from casbin_redis_watcher import new_watcher, WatcherOptions

def callback_function(event):
    print("update for remove filtered policy callback, event: {}".format(event))

def get_examples(path):
    examples_path = os.path.split(os.path.realpath(__file__))[0] + "/../examples/"
    return os.path.abspath(examples_path + path)

if __name__ == "main":
    test_option = WatcherOptions()
    test_option.host = "localhost"
    test_option.port = "6379"
    test_option.channel = "test"
    test_option.ssl = False
    test_option.optional_update_callback = callback_function
    w = new_watcher(test_option)
    
    e = casbin.Enforcer(
        get_examples("rbac_model.conf"), get_examples("rbac_policy.csv")
    )
    e.set_watcher(w)
    # then the callback function will be called when the policy is updated.
    e.save_policy()
   

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-redis-watcher 1.3.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-redis-watcher 1.3.0
File Size Uploaded Provenance Actions
casbin-redis-watcher-1.3.0.tar.gz 364.3 kB Without provenance Details for casbin-redis-watcher-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for casbin-redis-watcher 1.3.0
File Interpreter ABI Platform Actions
casbin_redis_watcher-1.3.0-py3-none-any.whl Python 3 none any Details for casbin_redis_watcher-1.3.0-py3-none-any.whl

Total release size: 763.4 kB

Release files / casbin-redis-watcher-1.3.0.tar.gz

Download URL casbin-redis-watcher-1.3.0.tar.gz
Size 364.3 kB
Tags Source
SHA-256 checksum
How to use checksums
957997766a449eda7f076d59c214d83445da2b9e454f12500413adfddcc5c410
BLAKE2b-256 checksum
How to use checksums
42737cd7269401a08514823da36877ad9bb41012e28f517500ead90ebcb0348d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.2

Release files / casbin_redis_watcher-1.3.0-py3-none-any.whl

Download URL casbin_redis_watcher-1.3.0-py3-none-any.whl
Size 399.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41aca4e8567c0f5af76f7f70bb12d582bfca7bdc809a9ba5005b42297c860f5f
BLAKE2b-256 checksum
How to use checksums
3d2587f1eabcbae0a01b81b090a7304e1ce5ddd7ba59027848458d0349613c47
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.2

Security for casbin-redis-watcher 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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