Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
urllib3-version: ["1.26.19", "2.2.2"]

steps:
- name: Checkout code
Expand All @@ -36,16 +37,18 @@ jobs:
**/test-requirements*.txt

- name: Install dependencies
run: pip install -r test-requirements.txt --upgrade pip
run: |
pip install -r test-requirements.txt --upgrade pip
pip install "urllib3==${{ matrix.urllib3-version }}"

- if: matrix.python-version == '3.10'
- if: matrix.python-version == '3.10' && matrix.urllib3-version == '1.26.19'
name: Run `ruff`
run: ruff check

- name: Run tests and collect coverage
run: pytest --cov-fail-under 60 --cov openfga_sdk

- if: matrix.python-version == '3.10'
- if: matrix.python-version == '3.10' && matrix.urllib3-version == '1.26.19'
name: Upload coverage to Codecov
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
continue-on-error: true
Expand Down
22 changes: 11 additions & 11 deletions openfga_sdk/sync/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ class RESTResponse(io.IOBase):
Represents an HTTP response object in the synchronous client.
"""

_response: urllib3.BaseHTTPResponse
_response: urllib3.HTTPResponse
_data: bytes
_status: int
_reason: str | None

def __init__(
self,
response: urllib3.BaseHTTPResponse,
response: urllib3.HTTPResponse,
data: bytes,
status: int | None = None,
reason: str | None = None,
) -> None:
"""
Initializes a RESTResponse with a urllib3.BaseHTTPResponse and corresponding data.
Initializes a RESTResponse with a urllib3.HTTPResponse and corresponding data.

:param resp: The urllib3.BaseHTTPResponse object.
:param resp: The urllib3.HTTPResponse object.
:param data: The raw byte data read from the response.
"""
self._response = response
Expand All @@ -65,16 +65,16 @@ def __init__(
self._reason = reason or response.reason

@property
def response(self) -> urllib3.BaseHTTPResponse:
def response(self) -> urllib3.HTTPResponse:
"""
Returns the underlying urllib3.BaseHTTPResponse object.
Returns the underlying urllib3.HTTPResponse object.
"""
return self._response

@response.setter
def response(self, value: urllib3.BaseHTTPResponse) -> None:
def response(self, value: urllib3.HTTPResponse) -> None:
"""
Sets the underlying urllib3.BaseHTTPResponse object.
Sets the underlying urllib3.HTTPResponse object.
"""
self._response = value

Expand Down Expand Up @@ -318,7 +318,7 @@ def build_request(
return args

def handle_response_exception(
self, response: RESTResponse | urllib3.BaseHTTPResponse
self, response: RESTResponse | urllib3.HTTPResponse
) -> None:
"""
Raises exceptions if response status indicates an error.
Expand Down Expand Up @@ -462,7 +462,7 @@ def request(
post_params: dict | None = None,
_preload_content: bool = True,
_request_timeout: float | tuple | None = None,
) -> RESTResponse | urllib3.BaseHTTPResponse:
) -> RESTResponse | urllib3.HTTPResponse:
"""
Executes a request and returns the response object.

Expand Down Expand Up @@ -493,7 +493,7 @@ def request(

# Send request, collect response handler
wrapped_response: RESTResponse | None = None
raw_response: urllib3.BaseHTTPResponse = self.pool_manager.request(**args)
raw_response: urllib3.HTTPResponse = self.pool_manager.request(**args)

# If we want to preload the response, read it
if _preload_content:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ aiohttp >= 3.9.3, < 4
python-dateutil >= 2.9.0, < 3
setuptools >= 69.1.1
build >= 1.2.1, < 2
urllib3 >= 1.25.11, < 3
urllib3 >= 1.26.19, >= 2.2.2, < 3
opentelemetry-api >= 1.25.0, < 2
Loading