Skip to content

Commit

Permalink
release: v0.4.2 (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
evansims authored Apr 4, 2024
2 parents 2adb952 + ebcf50d commit a83d02d
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 15 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## v0.4.2

### [0.4.2](https://github.com/openfga/python-sdk/compare/v0.4.1...v0.4.2) (2024-04-04)

- feat: support for modular models metadata
- feat: support auto-retry of failed network requests
- refactor: remove Python 2 code
- fix: limit the number of network retries
- fix: Configuration class `api_scheme`, `min_wait_in_ms` and `disabled_client_side_validations` validation issues
- chore: update aiohttp to 3.9.2
- chore: update black to 24.3.0

## v0.4.1

### [0.4.1](https://github.com/openfga/python-sdk/compare/v0.4.0...v0.4.1) (2024-02-13)
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ This is an autogenerated python SDK for OpenFGA. It provides a wrapper around th
- [Assertions](#assertions)
- [Read Assertions](#read-assertions)
- [Write Assertions](#write-assertions)
- [Retries](#retries)
- [API Endpoints](#api-endpoints)
- [Models](#models)
- [Contributing](#contributing)
Expand Down Expand Up @@ -956,6 +957,32 @@ response = await fga_client.write_assertions(body, options)
```


### Retries

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.

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.

Apply your custom retry values by passing the object to the `ClientConfiguration` constructor's `retry_params` parameter.

```python
from openfga_sdk import ClientConfiguration, OpenFgaClient
from openfga_sdk.configuration import RetryParams
from os import environ

async def main():
# Configure the client with custom retry settings
config = ClientConfiguration(
api_url=environ.get("FGA_API_URL"),
retry_params=RetryParams(max_retry=3, min_wait_in_ms=250)
)

# Create a client instance and read authorization models
async with OpenFgaClient(config) as client:
return await client.read_authorization_models()
```


### API Endpoints

Class | Method | HTTP request | Description
Expand Down
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.1
0.4.2
2 changes: 1 addition & 1 deletion example/example1/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ attrs >= 23.1.0
frozenlist >= 1.4.1
idna >= 3.6
multidict >= 6.0.4
openfga-sdk >= 0.4.1
openfga-sdk >= 0.4.2
python-dateutil >= 2.8.2
urllib3 >= 2.1.0
yarl >= 1.9.4
2 changes: 1 addition & 1 deletion openfga_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
"""

__version__ = "0.4.1"
__version__ = "0.4.2"

from openfga_sdk.api.open_fga_api import OpenFgaApi
from openfga_sdk.api_client import ApiClient
Expand Down
2 changes: 1 addition & 1 deletion openfga_sdk/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
ServiceException,
)

DEFAULT_USER_AGENT = "openfga-sdk python/0.4.1"
DEFAULT_USER_AGENT = "openfga-sdk python/0.4.2"


def random_time(loop_count, min_wait_in_ms):
Expand Down
2 changes: 1 addition & 1 deletion openfga_sdk/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def to_debug_report(self):
"OS: {env}\n"
"Python Version: {pyversion}\n"
"Version of the API: 0.1\n"
"SDK Package Version: 0.4.1".format(env=sys.platform, pyversion=sys.version)
"SDK Package Version: 0.4.2".format(env=sys.platform, pyversion=sys.version)
)

def get_host_settings(self):
Expand Down
2 changes: 1 addition & 1 deletion openfga_sdk/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ async def _obtain_token(self, client):
{
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "openfga-sdk (python) 0.4.1",
"User-Agent": "openfga-sdk (python) 0.4.2",
}
)

Expand Down
2 changes: 1 addition & 1 deletion openfga_sdk/sync/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
)
from openfga_sdk.sync import oauth2, rest

DEFAULT_USER_AGENT = "openfga-sdk python/0.4.1"
DEFAULT_USER_AGENT = "openfga-sdk python/0.4.2"


def random_time(loop_count, min_wait_in_ms):
Expand Down
2 changes: 1 addition & 1 deletion openfga_sdk/sync/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def _obtain_token(self, client):
{
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "openfga-sdk (python) 0.4.1",
"User-Agent": "openfga-sdk (python) 0.4.2",
}
)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import setuptools

NAME = "openfga-sdk"
VERSION = "0.4.1"
VERSION = "0.4.2"
REQUIRES = []


Expand Down
2 changes: 1 addition & 1 deletion test/test_oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def test_get_authentication_obtain_client_credentials(self, mock_request):
{
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "openfga-sdk (python) 0.4.1",
"User-Agent": "openfga-sdk (python) 0.4.2",
}
)
mock_request.assert_called_once_with(
Expand Down
2 changes: 1 addition & 1 deletion test/test_oauth2_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_get_authentication_obtain_client_credentials(self, mock_request):
{
"Accept": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent": "openfga-sdk (python) 0.4.1",
"User-Agent": "openfga-sdk (python) 0.4.2",
}
)
mock_request.assert_called_once_with(
Expand Down
4 changes: 2 additions & 2 deletions test/test_open_fga_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,7 @@ async def test_check_api_token(self, mock_request):
{
"Accept": "application/json",
"Content-Type": "application/json",
"User-Agent": "openfga-sdk python/0.4.1",
"User-Agent": "openfga-sdk python/0.4.2",
"Authorization": "Bearer TOKEN1",
}
)
Expand Down Expand Up @@ -1452,7 +1452,7 @@ async def test_check_custom_header(self, mock_request):
{
"Accept": "application/json",
"Content-Type": "application/json",
"User-Agent": "openfga-sdk python/0.4.1",
"User-Agent": "openfga-sdk python/0.4.2",
"Custom Header": "custom value",
}
)
Expand Down
4 changes: 2 additions & 2 deletions test/test_open_fga_api_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ async def test_check_api_token(self, mock_request):
{
"Accept": "application/json",
"Content-Type": "application/json",
"User-Agent": "openfga-sdk python/0.4.1",
"User-Agent": "openfga-sdk python/0.4.2",
"Authorization": "Bearer TOKEN1",
}
)
Expand Down Expand Up @@ -1449,7 +1449,7 @@ async def test_check_custom_header(self, mock_request):
{
"Accept": "application/json",
"Content-Type": "application/json",
"User-Agent": "openfga-sdk python/0.4.1",
"User-Agent": "openfga-sdk python/0.4.2",
"Custom Header": "custom value",
}
)
Expand Down

0 comments on commit a83d02d

Please sign in to comment.