authzed / authzed-py

Official SpiceDB client library for Python
https://docs.authzed.com/reference/api
Apache License 2.0
32 stars 11 forks source link

Unable to use the attributes from the gRPC Response #121

Open abhaybhargav opened 7 months ago

abhaybhargav commented 7 months ago

Hi there, I am trying to use this with the spicedb serverless product.

I am able to create policies, etc. but when I try to run a CheckPermissionsRequest (which I know works), it doesnt allow me to access the permissionship attribute, as indicated in your examples. What am I possibly doing wrong?

resp = client.CheckPermission(
    CheckPermissionRequest(
        resource=company_ref,
        permission="administrator",
        subject=blah,
    ),
)

print(resp.permissionship)
jtfidje commented 6 months ago

Hitting the same issue:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[36], line 1
----> 1 resp.permissionship

AttributeError: 'UnaryUnaryCall' object has no attribute 'permissionship'
vroldanbet commented 6 months ago

@abhaybhargav do any of those examples help? What version of the SDK are you using? Python version? https://github.com/authzed/authzed-py/blob/98e992171089c3b65e2c708a215947ac111c4562/tests/v1_test.py#L58-L102

jtfidje commented 6 months ago

I've done some digging and it appears that the issue may be related to the grpcio version. After checking out the poetry.lock file from the repository and reinstalling the dependencies, several packages were downgraded, including grpcio from 1.62.0 to 1.59.0.

Here is a list of downgrades that occurred:

  • Downgrading pyasn1 (0.5.1 -> 0.5.0)
  • Downgrading cachetools (5.3.3 -> 5.3.1)
  • Downgrading certifi (2024.2.2 -> 2023.7.22)
  • Downgrading charset-normalizer (3.3.2 -> 3.3.0)
  • Downgrading idna (3.6 -> 3.4)
  • Downgrading urllib3 (2.2.1 -> 2.0.7)
  • Downgrading appier (1.32.0 -> 1.31.4)
  • Downgrading google-auth (2.28.1 -> 2.23.3)
  • Downgrading googleapis-common-protos (1.62.0 -> 1.61.0)
  • Downgrading google-api-core (2.17.1 -> 2.15.0)
  • Downgrading grpcio (1.62.0 -> 1.59.0)

This may just be a coincidence. I'll try to create an environment where I can consistently reproduce the error and post here afterwards.