Skip to content

Commit ebcf50d

Browse files
committed
release: v0.4.2
1 parent 2adb952 commit ebcf50d

15 files changed

Lines changed: 54 additions & 15 deletions

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## v0.4.2
4+
5+
### [0.4.2](https://github.com/openfga/python-sdk/compare/v0.4.1...v0.4.2) (2024-04-04)
6+
7+
- feat: support for modular models metadata
8+
- feat: support auto-retry of failed network requests
9+
- refactor: remove Python 2 code
10+
- fix: limit the number of network retries
11+
- fix: Configuration class `api_scheme`, `min_wait_in_ms` and `disabled_client_side_validations` validation issues
12+
- chore: update aiohttp to 3.9.2
13+
- chore: update black to 24.3.0
14+
315
## v0.4.1
416

517
### [0.4.1](https://github.com/openfga/python-sdk/compare/v0.4.0...v0.4.1) (2024-02-13)

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ This is an autogenerated python SDK for OpenFGA. It provides a wrapper around th
4141
- [Assertions](#assertions)
4242
- [Read Assertions](#read-assertions)
4343
- [Write Assertions](#write-assertions)
44+
- [Retries](#retries)
4445
- [API Endpoints](#api-endpoints)
4546
- [Models](#models)
4647
- [Contributing](#contributing)
@@ -956,6 +957,32 @@ response = await fga_client.write_assertions(body, options)
956957
```
957958

958959

960+
### Retries
961+
962+
If a network request fails with a 429 or 5xx error from the server, the SDK will automatically retry the request up to 15 times with a minimum wait time of 100 milliseconds between each attempt.
963+
964+
To customize this behavior, create a `RetryParams` object and assign values to the `max_retry` and `min_wait_in_ms` constructor parameters. `max_retry` determines the maximum number of retries (up to 15), while `min_wait_in_ms` sets the minimum wait time between retries in milliseconds.
965+
966+
Apply your custom retry values by passing the object to the `ClientConfiguration` constructor's `retry_params` parameter.
967+
968+
```python
969+
from openfga_sdk import ClientConfiguration, OpenFgaClient
970+
from openfga_sdk.configuration import RetryParams
971+
from os import environ
972+
973+
async def main():
974+
# Configure the client with custom retry settings
975+
config = ClientConfiguration(
976+
api_url=environ.get("FGA_API_URL"),
977+
retry_params=RetryParams(max_retry=3, min_wait_in_ms=250)
978+
)
979+
980+
# Create a client instance and read authorization models
981+
async with OpenFgaClient(config) as client:
982+
return await client.read_authorization_models()
983+
```
984+
985+
959986
### API Endpoints
960987

961988
Class | Method | HTTP request | Description

VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.1
1+
0.4.2

example/example1/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ attrs >= 23.1.0
44
frozenlist >= 1.4.1
55
idna >= 3.6
66
multidict >= 6.0.4
7-
openfga-sdk >= 0.4.1
7+
openfga-sdk >= 0.4.2
88
python-dateutil >= 2.8.2
99
urllib3 >= 2.1.0
1010
yarl >= 1.9.4

openfga_sdk/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
1111
"""
1212

13-
__version__ = "0.4.1"
13+
__version__ = "0.4.2"
1414

1515
from openfga_sdk.api.open_fga_api import OpenFgaApi
1616
from openfga_sdk.api_client import ApiClient

openfga_sdk/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
ServiceException,
3434
)
3535

36-
DEFAULT_USER_AGENT = "openfga-sdk python/0.4.1"
36+
DEFAULT_USER_AGENT = "openfga-sdk python/0.4.2"
3737

3838

3939
def random_time(loop_count, min_wait_in_ms):

openfga_sdk/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ def to_debug_report(self):
469469
"OS: {env}\n"
470470
"Python Version: {pyversion}\n"
471471
"Version of the API: 0.1\n"
472-
"SDK Package Version: 0.4.1".format(env=sys.platform, pyversion=sys.version)
472+
"SDK Package Version: 0.4.2".format(env=sys.platform, pyversion=sys.version)
473473
)
474474

475475
def get_host_settings(self):

openfga_sdk/oauth2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async def _obtain_token(self, client):
8080
{
8181
"Accept": "application/json",
8282
"Content-Type": "application/x-www-form-urlencoded",
83-
"User-Agent": "openfga-sdk (python) 0.4.1",
83+
"User-Agent": "openfga-sdk (python) 0.4.2",
8484
}
8585
)
8686

openfga_sdk/sync/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
)
3434
from openfga_sdk.sync import oauth2, rest
3535

36-
DEFAULT_USER_AGENT = "openfga-sdk python/0.4.1"
36+
DEFAULT_USER_AGENT = "openfga-sdk python/0.4.2"
3737

3838

3939
def random_time(loop_count, min_wait_in_ms):

openfga_sdk/sync/oauth2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _obtain_token(self, client):
8080
{
8181
"Accept": "application/json",
8282
"Content-Type": "application/x-www-form-urlencoded",
83-
"User-Agent": "openfga-sdk (python) 0.4.1",
83+
"User-Agent": "openfga-sdk (python) 0.4.2",
8484
}
8585
)
8686

0 commit comments

Comments
 (0)