Skip to main content

Casbin role watcher to be used for monitoring updates to policies for PyCasbin

Project description

etcd-watcher

tests Coverage Status Version PyPI - Wheel Pyversions Download Discord

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

Installation

pip install etcd-watcher

Simple Example

import casbin
from etcd_watcher import new_watcher

def update_callback_func(event):
    ...

watcher = new_watcher(endpoints=["localhost", 2379], keyname="/casbin")
watcher.set_update_callback(update_callback_func)

e = casbin.Enforcer(
	get_examples("rbac_model.conf"), get_examples("rbac_policy.csv")
)

e.set_watcher(watcher)
# update_callback_func will be called
e.save_policy()

Getting Help

License

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

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

etcd_watcher-1.1.0.tar.gz (3.9 MB view details)

Uploaded Source

Built Distribution

etcd_watcher-1.1.0-py3-none-any.whl (4.7 MB view details)

Uploaded Python 3

File details

Details for the file etcd_watcher-1.1.0.tar.gz.

File metadata

  • Download URL: etcd_watcher-1.1.0.tar.gz
  • Upload date:
  • Size: 3.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for etcd_watcher-1.1.0.tar.gz
Algorithm Hash digest
SHA256 685ca92a7b947a5855b1ee73535c7573f95ee56acb9817581935362974ba0f2c
MD5 ea78d386f8fad1f378480d39f2e70afb
BLAKE2b-256 fb9cbeb31fd9458274fd5f03f008e0bb46c9691159bc427232131dbcd2e98568

See more details on using hashes here.

File details

Details for the file etcd_watcher-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for etcd_watcher-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d414b1dd3440d259f973de2ffb45c408c024e9fd10e92311f33a6b5cdeb4619
MD5 2a20b59c0def6c731a66696977ad7ef3
BLAKE2b-256 d41bead382657f9d412c137dc8edc5edec44dedacf165dac80d1aa159c268685

See more details on using hashes here.

Supported by

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