|
| 1 | +# ruff: noqa: E402 |
| 2 | + |
| 3 | +""" |
| 4 | +Python SDK for OpenFGA |
| 5 | +
|
| 6 | +API version: 1.x |
| 7 | +Website: https://openfga.dev |
| 8 | +Documentation: https://openfga.dev/docs |
| 9 | +Support: https://openfga.dev/community |
| 10 | +License: [Apache-2.0](https://github.com/openfga/python-sdk/blob/main/LICENSE) |
| 11 | +
|
| 12 | +NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. |
| 13 | +""" |
| 14 | + |
1 | 15 | import asyncio |
2 | 16 | import os |
3 | 17 | import sys |
| 18 | + |
4 | 19 | from operator import attrgetter |
5 | 20 | from random import randint |
6 | 21 | from typing import Any |
|
15 | 30 | ) |
16 | 31 | from opentelemetry.sdk.resources import SERVICE_NAME, Resource |
17 | 32 |
|
| 33 | + |
18 | 34 | # For usage convenience of this example, we will import the OpenFGA SDK from the parent directory. |
19 | 35 | sdk_path = os.path.realpath(os.path.join(os.path.abspath(__file__), "..", "..", "..")) |
20 | 36 | sys.path.insert(0, sdk_path) |
@@ -199,16 +215,15 @@ async def main(): |
199 | 215 | print(f"Making {checks_requests} checks ...", end=" ") |
200 | 216 | for _ in range(checks_requests): |
201 | 217 | try: |
202 | | - allowed = app().unpack( |
203 | | - await fga_client.check( |
204 | | - body=ClientCheckRequest( |
205 | | - user="user:anne", relation="owner", object="folder:foo" |
206 | | - ), |
| 218 | + await fga_client.check( |
| 219 | + body=ClientCheckRequest( |
| 220 | + user="user:anne", relation="owner", object="folder:foo" |
207 | 221 | ), |
208 | | - "allowed", |
209 | 222 | ) |
| 223 | + |
210 | 224 | except FgaValidationException as error: |
211 | 225 | print(f"Checked failed due to validation exception: {error}") |
| 226 | + |
212 | 227 | print("Done!") |
213 | 228 |
|
214 | 229 |
|
|
0 commit comments