feat: add the code (#1)

12 files changed
tree: 782d9814bcf493e5d53385fac8a0e185be1c7730
  1. casbin_cli/
  2. examples/
  3. .gitignore
  4. LICENSE
  5. README.md
  6. requirements.txt
  7. setup.py
README.md

casbin-python-cli

PyPI - Python Version PyPI - License PyPI - PyCasbin Version

Installation

Prerequisites

  • Python 3.6+
  • pip package manager

Installation Methods

Clone from repository:

git clone https://github.com/casbin/casbin-python-cli.git
cd casbin-python-cli
pip install -r requirements.txt

Method

python -m casbin_cli.client [command] [options] [args]

python -m casbin_cli.client enforce -m "examples/rbac_model.conf" -p "examples/rbac_policy.csv" "alice" "data1" "read"

{"allow":true,"explain":null}

Project Structure

casbin-python-cli/
├── casbin_cli/
│   ├── __init__.py
│   ├── client.py          # Main entry point and CLI argument parsing
│   ├── command_executor.py # Dynamic method execution and JSON response
│   ├── enforcer_factory.py # Enforcer creation and input validation
│   ├── response.py        # JSON response formatting
│   └── utils.py           # Utility functions
├── examples/              # Example configuration files
├── requirements.txt       # Python dependencies
├── setup.py               # Package installation script
└── README.md

Requirements

  • Python 3.6+
  • PyCasbin 1.17.0+

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.