Skip to main content

Client library for the Authzed service.

Project description

Authzed Python Client

This repository houses the Python client library for Authzed.

The library maintains various versions the Authzed gRPC APIs. You can find more info on each API on the Authzed API reference documentation. Additionally, Protobuf API documentation can be found on the Buf Registry Authzed API repository.

Supported API versions:

  • v1alpha1
  • v0
  • arrakisclient (v0 Legacy ORM)

Installation

pip install authzed

Example

Everything API specific is in its respective authzed.api.VERSION module. grpcutil contains functionality for making interacting with gRPC simple.

from authzed.api.v1alpha1 import Client, ReadSchemaRequest
from grpcutil import bearer_token_credentials


client = Client("grpc.authzed.com:443", bearer_token_credentials("mytoken"))
resp = client.ReadSchema(ReadSchemaRequest(object_definitions_names=["example/user"]))
print(resp.object_definitions)

If an event loop is running when the client is initialized, all functions calls are async:

import asyncio

from authzed.api.v1alpha1 import Client, ReadSchemaRequest
from grpcutil import bearer_token_credentials


async def async_new_client():
    # Within an async context, the client's methods are all async:
    client = Client("grpc.authzed.com:443", bearer_token_credentials("mytoken"))
    resp = await client.ReadSchema(ReadSchemaRequest(object_definitions_names=["example/user"]))
    print(resp)

loop = asyncio.get_event_loop()
try:
    loop.run_until_complete(async_new_client())
finally:
    loop.close()

Full Examples

Full examples for each version of the API can be found in the examples directory.

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

authzed-0.3.1.tar.gz (61.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

authzed-0.3.1-py3-none-any.whl (79.5 kB view details)

Uploaded Python 3

File details

Details for the file authzed-0.3.1.tar.gz.

File metadata

  • Download URL: authzed-0.3.1.tar.gz
  • Upload date:
  • Size: 61.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for authzed-0.3.1.tar.gz
Algorithm Hash digest
SHA256 634d52d57c0312a2cdd0e92eb0e88bb50e294a3f6898a6b9546161b2d8b7cda2
MD5 1a0a296b6e4d83dd606178858fd8b6f2
BLAKE2b-256 5ef5c2e1c67c4c830dd0dba3d3769c43f90690df289ecda4170fd78d3041a46a

See more details on using hashes here.

File details

Details for the file authzed-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: authzed-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 79.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for authzed-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 80eabc90f97f0b9408af1928267ef5cd8ac8c5a7a0c157b6f8969aac9c2c6e71
MD5 de644e1be9c76c6333a1e125a229ca08
BLAKE2b-256 84b020ba95a22fc39da4d4fb01ecd1add3c53654d130b9dd38028c4f88083b66

See more details on using hashes here.

Supported by

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