openfga / python-sdk

OpenFGA SDK for Python 3 - https://pypi.org/project/openfga-sdk/
https://openfga.dev
Apache License 2.0
38 stars 15 forks source link

Python SDK should retry on 5xx errors #73

Closed rhamzeh closed 7 months ago

rhamzeh commented 8 months ago

Checklist

Description

The SDK currently retries only on 429 errors

https://github.com/openfga/python-sdk/blob/main/openfga_sdk/sync/api_client.py#L210-L234

It should retry on 429 and 5xx errors except for 501 Not Implemented

Expectation

SDK retries on 5xx errors

Reproduction

  1. Call the API
  2. Get a 500 response
  3. SDK does not retry and returns the error

OpenFGA SDK version

v0.4.1

OpenFGA version

N/A

SDK Configuration

configuration = ClientConfiguration( api_url=FGA_API_URL, # required store_id=FGA_STORE_ID, # optional, not needed when calling CreateStore or ListStores authorization_model_id=FGA_AUTHORIZATION_MODEL_ID, # Optional, can be overridden per request credentials=Credentials( method='client_credentials', configuration=CredentialConfiguration( api_issuer=FGA_API_TOKEN_ISSUER, api_audience=FGA_API_AUDIENCE, client_id=FGA_CLIENT_ID, client_secret=FGA_CLIENT_SECRET, ) ) )

Logs

No response

References

No response