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
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t", "3.15", "3.15t"]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Installation
$ pip install aiopenapi3


* aiopenapi3[auth] will install httpx2-auth_ which is required to authenticate using oauth2/azuread/. Currently httpx2-auth is `limited to Sync <https://github.com/Colin-b/httpx2_auth/pull/48>`_ operations.
.. aiopenapi3[auth] will install httpx2-auth_ which is required to authenticate using oauth2/azuread/. Currently httpx2-auth is `limited to Sync <https://github.com/Colin-b/httpx2_auth/pull/48>`_ operations.
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ classifiers = [
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3.15",
]
dynamic = ['version']

Expand All @@ -50,9 +51,9 @@ Documentation = "https://aiopenapi3.readthedocs.io/"
Repository = "https://github.com/commonism/aiopenapi3"

[project.optional-dependencies]
auth = [
"httpx-auth>=0.21.0",
]
#auth = [
# "httpx2-auth>=0.21.0",
#]
types =[
"pydantic-extra-types>=2.10.1",
]
Expand Down
22 changes: 12 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@
.
annotated-types==0.8.0
# via pydantic
anyio==4.14.2
anyio==4.15.0 ; sys_platform != 'emscripten'
# via httpx2
dnspython==2.8.0
# via email-validator
email-validator==2.3.0
# via aiopenapi3
exceptiongroup==1.3.1 ; python_full_version < '3.11'
exceptiongroup==1.3.1 ; python_full_version < '3.11' and sys_platform != 'emscripten'
# via anyio
h11==0.16.0
h11==0.16.0 ; sys_platform != 'emscripten'
# via httpcore2
httpcore2==2.9.0
httpcore2==2.12.0 ; sys_platform != 'emscripten'
# via httpx2
httpx2==2.9.0
httpx2==2.12.0
# via aiopenapi3
idna==3.18
httpx2-jsfetch==1.0 ; python_full_version >= '3.12' and sys_platform == 'emscripten'
# via httpx2
idna==3.19
# via
# anyio
# email-validator
Expand All @@ -35,13 +37,13 @@ multidict==6.7.1
# via yarl
propcache==0.5.2
# via yarl
pydantic==2.14.0a1
pydantic==2.13.5
# via aiopenapi3
pydantic-core==2.47.0
pydantic-core==2.46.5
# via pydantic
pyyaml==6.0.3
# via aiopenapi3
truststore==0.10.4
truststore==0.10.4 ; sys_platform != 'emscripten'
# via
# httpcore2
# httpx2
Expand All @@ -55,7 +57,7 @@ typing-extensions==4.16.0
# pydantic
# pydantic-core
# typing-inspection
typing-inspection==0.4.2
typing-inspection==0.4.4
# via pydantic
yarl==1.24.5
# via aiopenapi3
5 changes: 4 additions & 1 deletion src/aiopenapi3/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,10 @@ def read(self, num_bytes: int) -> bytes:
if num_bytes == 0:
return b""

return next(self._iter_bytes)
try:
return next(self._iter_bytes)
except StopIteration:
return b""

def iter_json(response: httpx2.Response) -> Iterator["JSON"]:
reader = ReadEventStream(response)
Expand Down
12 changes: 6 additions & 6 deletions tests/error_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@
)


def test_response_error(httpx_mock, with_paths_response_error_vXX):
def test_response_error(httpx2_mock, with_paths_response_error_vXX):
api = OpenAPI("/", with_paths_response_error_vXX, session_factory=httpx2.Client)

httpx_mock.add_response(headers={"Content-Type": "application/json"}, status_code=200, json="ok")
httpx2_mock.add_response(headers={"Content-Type": "application/json"}, status_code=200, json="ok")
r = api._.test()
assert r == "ok"

httpx_mock.add_response(headers={"Content-Type": "text/html"}, status_code=200, json="ok")
httpx2_mock.add_response(headers={"Content-Type": "text/html"}, status_code=200, json="ok")
with pytest.raises(ContentTypeError) as e:
api._.test()
str(e.value)

httpx_mock.add_response(headers={"Content-Type": "application/json"}, status_code=201, json="ok")
httpx2_mock.add_response(headers={"Content-Type": "application/json"}, status_code=201, json="ok")
with pytest.raises(HTTPStatusError) as e:
api._.test()
str(e.value)

httpx_mock.add_response(headers={"Content-Type": "application/json"}, status_code=200, content="'")
httpx2_mock.add_response(headers={"Content-Type": "application/json"}, status_code=200, content="'")
with pytest.raises(ResponseDecodingError) as e:
api._.test()
str(e.value)

httpx_mock.add_response(headers={"Content-Type": "application/json"}, status_code=200, json="fail")
httpx2_mock.add_response(headers={"Content-Type": "application/json"}, status_code=200, json="fail")
with pytest.raises(ResponseSchemaError) as e:
api._.test()
str(e.value)
Expand Down
Loading
Loading