{"id":13520965,"url":"https://github.com/authzed/authzed-py","last_synced_at":"2025-04-04T17:09:47.223Z","repository":{"id":41867478,"uuid":"333169360","full_name":"authzed/authzed-py","owner":"authzed","description":"Official SpiceDB client library for Python","archived":false,"fork":false,"pushed_at":"2025-03-24T12:23:00.000Z","size":1390,"stargazers_count":33,"open_issues_count":12,"forks_count":16,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-30T21:45:42.163Z","etag":null,"topics":["asyncio","authorization","authzed","authzed-client","fine-grained-access-control","fine-grained-authorization","permissions","python","sdk","spicedb","spicedb-client","zanzibar"],"latest_commit_sha":null,"homepage":"https://docs.authzed.com/reference/api","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/authzed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE-OF-CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-26T17:54:58.000Z","updated_at":"2025-02-24T15:59:45.000Z","dependencies_parsed_at":"2024-01-02T12:30:44.346Z","dependency_job_id":"670d3e1d-73f9-4397-a196-91dbcddc8d80","html_url":"https://github.com/authzed/authzed-py","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authzed%2Fauthzed-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authzed%2Fauthzed-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authzed%2Fauthzed-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authzed%2Fauthzed-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/authzed","download_url":"https://codeload.github.com/authzed/authzed-py/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217221,"owners_count":20903009,"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":["asyncio","authorization","authzed","authzed-client","fine-grained-access-control","fine-grained-authorization","permissions","python","sdk","spicedb","spicedb-client","zanzibar"],"created_at":"2024-08-01T06:00:25.199Z","updated_at":"2025-04-04T17:09:47.205Z","avatar_url":"https://github.com/authzed.png","language":"Python","funding_links":[],"categories":["Clients"],"sub_categories":["Official Libraries"],"readme":"# Authzed Python Client\n\n[![PyPI](https://img.shields.io/pypi/v/authzed?color=%23006dad)](https://pypi.org/project/authzed)\n[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)\n[![Build Status](https://github.com/authzed/authzed-py/workflows/Test/badge.svg)](https://github.com/authzed/authzed-py/actions)\n[![Mailing List](https://img.shields.io/badge/email-google%20groups-4285F4)](https://groups.google.com/g/authzed-oss)\n[![Discord Server](https://img.shields.io/discord/844600078504951838?color=7289da\u0026logo=discord \"Discord Server\")](https://discord.gg/jTysUaxXzM)\n[![Twitter](https://img.shields.io/twitter/follow/authzed?color=%23179CF0\u0026logo=twitter\u0026style=flat-square)](https://twitter.com/authzed)\n\nThis repository houses the Python client library for Authzed.\n\n[Authzed] is a database and service that stores, computes, and validates your application's permissions.\n\nDevelopers create a schema that models their permissions requirements and use a client library, such as this one, to apply the schema to the database, insert data into the database, and query the data to efficiently check permissions in their applications.\n\nSupported client API versions:\n\n- [v1](https://docs.authzed.com/reference/api#authzedapiv1)\n\nYou can find more info on each API on the [Authzed API reference documentation].\nAdditionally, Protobuf API documentation can be found on the [Buf Registry Authzed API repository].\n\nSee [CONTRIBUTING.md] for instructions on how to contribute and perform common tasks like building the project and running tests.\n\n[Authzed]: https://authzed.com\n[Authzed API Reference documentation]: https://docs.authzed.com/reference/api\n[Buf Registry Authzed API repository]: https://buf.build/authzed/api/docs/main\n[CONTRIBUTING.md]: CONTRIBUTING.md\n\n## Getting Started\n\nWe highly recommend following the **[Protecting Your First App]** guide to learn the latest best practice to integrate an application with Authzed.\n\nIf you're interested in examples of a specific version of the API, they can be found in their respective folders in the [examples directory].\n\n[Protecting Your First App]: https://docs.authzed.com/guides/first-app\n[examples directory]: /examples\n\n## Basic Usage\n\n### Installation\n\nThis project is packaged as the wheel `authzed` on the [Python Package Index].\n\nIf you are using [pip], the command to install the library is:\n\n```sh\npip install authzed\n```\n\n[Python Package Index]: https://pypi.org/project/authzed\n[pip]: https://pip.pypa.io\n\n### Initializing a client\n\nWith the exception of [gRPC] utility functions found in `grpcutil`, everything required to connect and make API calls is located in a module respective to API version.\n\nIn order to successfully connect, you will have to provide a [Bearer Token] with your own API Token from the [Authzed dashboard] in place of `t_your_token_here_1234567deadbeef` in the following example:\n\n[grpc]: https://grpc.io\n[Bearer Token]: https://datatracker.ietf.org/doc/html/rfc6750#section-2.1\n[Authzed Dashboard]: https://app.authzed.com\n\n```py\nfrom authzed.api.v1 import Client\nfrom grpcutil import bearer_token_credentials\n\n\nclient = Client(\n    \"grpc.authzed.com:443\",\n    bearer_token_credentials(\"t_your_token_here_1234567deadbeef\"),\n)\n```\n\n### Performing an API call\n\n```py\nfrom authzed.api.v1 import (\n    CheckPermissionRequest,\n    CheckPermissionResponse,\n    ObjectReference,\n    SubjectReference,\n)\n\n\npost_one = ObjectReference(object_type=\"blog/post\", object_id=\"1\")\nemilia = SubjectReference(object=ObjectReference(\n    object_type=\"blog/user\",\n    object_id=\"emilia\",\n))\n\n# Is Emilia in the set of users that can read post #1?\nresp = client.CheckPermission(CheckPermissionRequest(\n    resource=post_one,\n    permission=\"reader\",\n    subject=emilia,\n))\nassert resp.permissionship == CheckPermissionResponse.PERMISSIONSHIP_HAS_PERMISSION\n```\n\n### Insecure Client Usage\nWhen running in a context like `docker compose`, because of Docker's virtual networking,\nthe gRPC client sees the SpiceDB container as \"remote.\" It has built-in safeguards to prevent\ncalling a remote client in an insecure manner, such as using client credentials without TLS.\n\nHowever, this is a pain when setting up a development or testing environment, so we provide\nthe `InsecureClient` as a convenience:\n\n```py\nfrom authzed.api.v1 import InsecureClient\n\nclient = InsecureClient(\n    \"spicedb:50051\",\n    \"my super secret token\"\n)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthzed%2Fauthzed-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauthzed%2Fauthzed-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthzed%2Fauthzed-py/lists"}