https://github.com/officialpycasbin/etcd-watcher
etcd watcher for PyCasbin
https://github.com/officialpycasbin/etcd-watcher
abac acl auth authorization authz casbin cloud-native cloudnative etcd middleware pycasbin python rbac watcher
Last synced: 5 months ago
JSON representation
etcd watcher for PyCasbin
- Host: GitHub
- URL: https://github.com/officialpycasbin/etcd-watcher
- Owner: officialpycasbin
- License: apache-2.0
- Created: 2024-11-12T01:17:41.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-11-12T02:00:49.000Z (over 1 year ago)
- Last Synced: 2025-03-25T17:49:24.988Z (about 1 year ago)
- Topics: abac, acl, auth, authorization, authz, casbin, cloud-native, cloudnative, etcd, middleware, pycasbin, python, rbac, watcher
- Language: Python
- Homepage: https://github.com/casbin/pycasbin
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# etcd-watcher
[](https://github.com/officialpycasbin/etcd-watcher/actions/workflows/release.yml)
[](https://coveralls.io/github/officialpycasbin/etcd-watcher)
[](https://pypi.org/project/etcd-watcher/)
[](https://pypi.org/project/etcd-watcher/)
[](https://pypi.org/project/etcd-watcher/)
[](https://pypi.org/project/etcd-watcher/)
[](https://discord.gg/S5UjpzGZjN)
Etcd Watcher is the [Etcd](https://github.com/coreos/etcd) watcher for [pycasbin](https://github.com/casbin/pycasbin). With this library, Casbin can synchronize the policy with the database in multiple enforcer instances.
## Installation
pip install etcd-watcher
## Simple Example
```python
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
- [Casbin](https://github.com/casbin/pycasbin)
## License
This project is under Apache 2.0 License. See the [LICENSE](LICENSE) file for the full license text.