diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index a634af6..3df9ef2 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -12,11 +12,14 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11"] + python-version: ["3.10", "3.11", "3.12"] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 with: python-version: ${{ matrix.python-version }} cache: 'pip' @@ -40,9 +43,12 @@ jobs: needs: [test] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 + - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 with: python-version: "3.10" cache: 'pip' @@ -60,7 +66,7 @@ jobs: python setup.py sdist bdist_wheel - name: Publish package - uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} @@ -71,9 +77,11 @@ jobs: needs: [publish] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 - - uses: Roang-zero1/github-create-release-action@57eb9bdce7a964e48788b9e78b5ac766cb684803 + - uses: Roang-zero1/github-create-release-action@57eb9bdce7a964e48788b9e78b5ac766cb684803 # v3.0.1 with: version_regex: ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ env: diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 4ffc69b..725c992 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -92,6 +92,7 @@ openfga_sdk/client/models/write_transaction_opts.py openfga_sdk/configuration.py openfga_sdk/credentials.py openfga_sdk/exceptions.py +openfga_sdk/help.py openfga_sdk/models/__init__.py openfga_sdk/models/any.py openfga_sdk/models/assertion.py diff --git a/CHANGELOG.md b/CHANGELOG.md index f42cd28..0e4e7f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v0.3.2 + +### [0.3.2](https://github.com/openfga/python-sdk/compare/v0.3.1...v0.3.2) (2023-12-15) +- feat: allow passing ssl certs to client configuration +- feat: setup openfga_sdk.help for bug info + ## v0.3.1 ### [0.3.1](https://github.com/openfga/python-sdk/compare/v0.3.0...v0.3.1) (2023-12-01) diff --git a/README.md b/README.md index 272efc3..427e351 100644 --- a/README.md +++ b/README.md @@ -130,10 +130,10 @@ from openfga_sdk.client import OpenFgaClient async def main(): configuration = openfga_sdk.ClientConfiguration( - api_scheme = OPENFGA_API_SCHEME, # optional, defaults to "https" - api_host = OPENFGA_API_HOST, # required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example) - store_id = OPENFGA_STORE_ID, # optional, not needed when calling `CreateStore` or `ListStores` - authorization_model_id = OPENFGA_AUTHORIZATION_MODEL_ID, # Optional, can be overridden per request + api_scheme = FGA_API_SCHEME, # optional, defaults to "https" + api_host = FGA_API_HOST, # required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example) + 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 ) # Enter a context with an instance of the OpenFgaClient async with OpenFgaClient(configuration) as fga_client: @@ -152,14 +152,14 @@ from openfga_sdk.credentials import Credentials, CredentialConfiguration async def main(): configuration = openfga_sdk.ClientConfiguration( - api_scheme = OPENFGA_API_SCHEME, # optional, defaults to "https" - api_host = OPENFGA_API_HOST, # required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example) - store_id = OPENFGA_STORE_ID, # optional, not needed when calling `CreateStore` or `ListStores` - authorization_model_id = OPENFGA_AUTHORIZATION_MODEL_ID, # Optional, can be overridden per request + api_scheme = FGA_API_SCHEME, # optional, defaults to "https" + api_host = FGA_API_HOST, # required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example) + 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='api_token', - configuration=CredentialConfiguration( - api_token= OPENFGA_API_TOKEN, + configuration = CredentialConfiguration( + api_token = FGA_API_TOKEN, ) ) ) @@ -180,17 +180,17 @@ from openfga_sdk.credentials import Credentials, CredentialConfiguration async def main(): configuration = openfga_sdk.ClientConfiguration( - api_scheme = OPENFGA_API_SCHEME, # optional, defaults to "https" - api_host = OPENFGA_API_HOST, # required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example) - store_id = OPENFGA_STORE_ID, # optional, not needed when calling `CreateStore` or `ListStores` - authorization_model_id = OPENFGA_AUTHORIZATION_MODEL_ID, # Optional, can be overridden per request + api_scheme = FGA_API_SCHEME, # optional, defaults to "https" + api_host = FGA_API_HOST, # required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example) + 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= OPENFGA_API_TOKEN_ISSUER, - api_audience= OPENFGA_API_AUDIENCE, - client_id= OPENFGA_CLIENT_ID, - client_secret= OPENFGA_CLIENT_SECRET, + 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, ) ) ) @@ -214,10 +214,10 @@ from openfga_sdk.sync import OpenFgaClient def main(): configuration = openfga_sdk.ClientConfiguration( - api_scheme=OPENFGA_API_SCHEME, # optional, defaults to "https" - api_host=OPENFGA_API_HOST, # required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example) - store_id=OPENFGA_STORE_ID, # optional, not needed when calling `CreateStore` or `ListStores` - authorization_model_id=OPENFGA_AUTHORIZATION_MODEL_ID, # optional, can be overridden per request + api_scheme = FGA_API_SCHEME, # optional, defaults to "https" + api_host = FGA_API_HOST, # required, define without the scheme (e.g. api.fga.example instead of https://api.fga.example) + 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 ) # Enter a context with an instance of the OpenFgaClient with OpenFgaClient(configuration) as fga_client: diff --git a/VERSION.txt b/VERSION.txt index 9e11b32..d15723f 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -0.3.1 +0.3.2 diff --git a/openfga_sdk/__init__.py b/openfga_sdk/__init__.py index fa95385..99e16c5 100644 --- a/openfga_sdk/__init__.py +++ b/openfga_sdk/__init__.py @@ -14,7 +14,7 @@ NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. """ -__version__ = "0.3.1" +__version__ = "0.3.2" from openfga_sdk.client.client import OpenFgaClient from openfga_sdk.client.configuration import ClientConfiguration diff --git a/openfga_sdk/api_client.py b/openfga_sdk/api_client.py index 9847926..05157e1 100644 --- a/openfga_sdk/api_client.py +++ b/openfga_sdk/api_client.py @@ -34,7 +34,7 @@ from openfga_sdk.exceptions import ApiValueError, ApiException, FgaValidationException, RateLimitExceededError -DEFAULT_USER_AGENT = 'openfga-sdk python/0.3.1' +DEFAULT_USER_AGENT = 'openfga-sdk python/0.3.2' def random_time(loop_count, min_wait_in_ms): diff --git a/openfga_sdk/configuration.py b/openfga_sdk/configuration.py index 5a0b624..b9ffa17 100644 --- a/openfga_sdk/configuration.py +++ b/openfga_sdk/configuration.py @@ -439,7 +439,7 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 0.1\n"\ - "SDK Package Version: 0.3.1".\ + "SDK Package Version: 0.3.2".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/openfga_sdk/oauth2.py b/openfga_sdk/oauth2.py index d929992..3f94bf6 100644 --- a/openfga_sdk/oauth2.py +++ b/openfga_sdk/oauth2.py @@ -54,7 +54,7 @@ async def _obtain_token(self, client): 'grant_type': "client_credentials", } headers = urllib3.response.HTTPHeaderDict( - {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk (python) 0.3.1'}) + {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk (python) 0.3.2'}) raw_response = await client.POST(token_url, headers=headers, body=body) if 200 <= raw_response.status <= 299: try: diff --git a/openfga_sdk/sync/api_client.py b/openfga_sdk/sync/api_client.py index af2ceba..d6ca7f6 100644 --- a/openfga_sdk/sync/api_client.py +++ b/openfga_sdk/sync/api_client.py @@ -34,7 +34,7 @@ from openfga_sdk.exceptions import ApiValueError, ApiException, FgaValidationException, RateLimitExceededError -DEFAULT_USER_AGENT = 'openfga-sdk python/0.3.1' +DEFAULT_USER_AGENT = 'openfga-sdk python/0.3.2' def random_time(loop_count, min_wait_in_ms): diff --git a/openfga_sdk/sync/oauth2.py b/openfga_sdk/sync/oauth2.py index 3449307..f58cf04 100644 --- a/openfga_sdk/sync/oauth2.py +++ b/openfga_sdk/sync/oauth2.py @@ -54,7 +54,7 @@ def _obtain_token(self, client): 'grant_type': "client_credentials", } headers = urllib3.response.HTTPHeaderDict( - {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk (python) 0.3.1'}) + {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk (python) 0.3.2'}) raw_response = client.POST(token_url, headers=headers, body=body) if 200 <= raw_response.status <= 299: try: diff --git a/setup.py b/setup.py index 65c1cbd..98d6989 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "openfga-sdk" -VERSION = "0.3.1" +VERSION = "0.3.2" # To install the library, run the following # # python setup.py install diff --git a/test/test_oauth2.py b/test/test_oauth2.py index a0ecd2f..55a7643 100644 --- a/test/test_oauth2.py +++ b/test/test_oauth2.py @@ -82,7 +82,7 @@ async def test_get_authentication_obtain_client_credentials(self, mock_request): self.assertGreaterEqual(client._access_expiry_time, current_time + timedelta(seconds=int(120))) expected_header = urllib3.response.HTTPHeaderDict( - {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk (python) 0.3.1'}) + {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk (python) 0.3.2'}) mock_request.assert_called_once_with( 'POST', 'https://www.testme.com/oauth/token', diff --git a/test/test_oauth2_sync.py b/test/test_oauth2_sync.py index 62f3fe8..9b42b6f 100644 --- a/test/test_oauth2_sync.py +++ b/test/test_oauth2_sync.py @@ -83,7 +83,7 @@ def test_get_authentication_obtain_client_credentials(self, mock_request): self.assertGreaterEqual(client._access_expiry_time, current_time + timedelta(seconds=int(120))) expected_header = urllib3.response.HTTPHeaderDict( - {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk (python) 0.3.1'}) + {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk (python) 0.3.2'}) mock_request.assert_called_once_with( 'POST', 'https://www.testme.com/oauth/token', diff --git a/test/test_open_fga_api.py b/test/test_open_fga_api.py index fe033cf..3bfae08 100644 --- a/test/test_open_fga_api.py +++ b/test/test_open_fga_api.py @@ -1174,7 +1174,7 @@ async def test_check_api_token(self, mock_request): self.assertTrue(api_response.allowed) # Make sure the API was called with the right data expectedHeader = urllib3.response.HTTPHeaderDict( - {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk python/0.3.1', 'Authorization': 'Bearer TOKEN1'}) + {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk python/0.3.2', 'Authorization': 'Bearer TOKEN1'}) mock_request.assert_called_once_with( 'POST', 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4/check', @@ -1217,7 +1217,7 @@ async def test_check_custom_header(self, mock_request): self.assertTrue(api_response.allowed) # Make sure the API was called with the right data expectedHeader = urllib3.response.HTTPHeaderDict( - {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk python/0.3.1', 'Custom Header': 'custom value'}) + {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk python/0.3.2', 'Custom Header': 'custom value'}) mock_request.assert_called_once_with( 'POST', 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4/check', diff --git a/test/test_open_fga_api_sync.py b/test/test_open_fga_api_sync.py index 4db99c6..c0c6225 100644 --- a/test/test_open_fga_api_sync.py +++ b/test/test_open_fga_api_sync.py @@ -1175,7 +1175,7 @@ async def test_check_api_token(self, mock_request): self.assertTrue(api_response.allowed) # Make sure the API was called with the right data expectedHeader = urllib3.response.HTTPHeaderDict( - {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk python/0.3.1', 'Authorization': 'Bearer TOKEN1'}) + {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk python/0.3.2', 'Authorization': 'Bearer TOKEN1'}) mock_request.assert_called_once_with( 'POST', 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4/check', @@ -1218,7 +1218,7 @@ async def test_check_custom_header(self, mock_request): self.assertTrue(api_response.allowed) # Make sure the API was called with the right data expectedHeader = urllib3.response.HTTPHeaderDict( - {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk python/0.3.1', 'Custom Header': 'custom value'}) + {'Accept': 'application/json', 'Content-Type': 'application/json', 'User-Agent': 'openfga-sdk python/0.3.2', 'Custom Header': 'custom value'}) mock_request.assert_called_once_with( 'POST', 'http://api.fga.example/stores/01H0H015178Y2V4CX10C2KGHF4/check',