{"id":17948822,"url":"https://github.com/eko/authz-python-sdk","last_synced_at":"2025-04-03T15:27:33.170Z","repository":{"id":66290798,"uuid":"587900983","full_name":"eko/authz-python-sdk","owner":"eko","description":"Authz Python SDK","archived":false,"fork":false,"pushed_at":"2023-02-05T08:43:21.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-09T15:04:45.291Z","etag":null,"topics":["abac","authorization","permissions","python","rbac"],"latest_commit_sha":null,"homepage":"https://authz.fr","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-11T21:14:33.000Z","updated_at":"2023-01-26T12:30:24.000Z","dependencies_parsed_at":"2023-02-23T02:45:17.642Z","dependency_job_id":null,"html_url":"https://github.com/eko/authz-python-sdk","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"e925ad0bb64dce9713dae3e52f275a73b7bb8596"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eko%2Fauthz-python-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eko%2Fauthz-python-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eko%2Fauthz-python-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eko%2Fauthz-python-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eko","download_url":"https://codeload.github.com/eko/authz-python-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247026599,"owners_count":20871400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abac","authorization","permissions","python","rbac"],"created_at":"2024-10-29T09:10:12.749Z","updated_at":"2025-04-03T15:27:33.150Z","avatar_url":"https://github.com/eko.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Authz Python SDK\n\nThis is the Authz development kit for Python.\n\n## Installation\n\nYou can install in your projects by importing the following dependency:\n\n```bash\n$ pip install authz-sdk\n```\n\n## Usage\n\nYou have to instanciate a new Authz Client in your code by doing:\n\n```python\nclient = authz.Client('localhost:8081', '\u003cclient_id\u003e', '\u003cclient_secret\u003e')\n```\n\nOnce the client is instanciate, you have access to all the gRPC methods under `stub` property.\n\nIn order to create a new Principal, you can use\n\n```python\nresponse = client.stub.PrincipalCreate(proto.PrincipalCreateRequest(\n    id='user-123',\n    attributes=[\n        proto.Attribute(key='email', value='johndoe@acme.tld'),\n    ],\n))\n```\n\nTo declare a new resource:\n\n```python\nresponse = client.stub.ResourceCreate(proto.ResourceCreateRequest(\n    id='post.456',\n    kind='post',\n    value='456',\n    attributes=[\n        proto.Attribute(key='owner_email', value='johndoe@acme.tld'),\n    ],\n))\n```\n\nYou can also declare a new policy this way:\n\n```python\nresponse = client.stub.PolicyCreate(proto.PolicyCreateRequest(\n    id='post-owners',\n    resources=['post.*'],\n    actions=['edit', 'delete'],\n    attribute_rules=[\n        'principal.email == resource.owner_email',\n    ],\n))\n```\n\nThen, you can perform a check with:\n\n```python\nis_allowed = client.IsAllowed(\n    principal='user-123',\n    resource_kind='post',\n    resource_value='123',\n    action='edit',\n)\n\nif is_allowed:\n    # do something\n```\n\nPlease note that you have access to all the gRPC methods [declared here](https://github.com/eko/authz/blob/master/backend/api/proto/api.proto) in the proto file.\n\n## Configuration\n\nThis SDK connects over gRPC to the backend service. Here are the available configuration options:\n\n| Property | Description |\n| -------- | ----------- |\n| ClientID | Your service account client id used to authenticate |\n| ClientSecret | Your service account client secret key used to authenticate |\n| GrpcAddr | Authz backend to connect to |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feko%2Fauthz-python-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feko%2Fauthz-python-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feko%2Fauthz-python-sdk/lists"}