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
4 changes: 2 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Changelog
Next
----

2024.09.03.1
------------
* Move ``Response`` from ``vws.exceptions.response`` to ``vws.types``.
* Add ``raw`` field to ``Response``.

2024.09.03
------------
Expand Down
4 changes: 4 additions & 0 deletions docs/source/api-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ API Reference
.. automodule:: vws.include_target_data
:undoc-members:
:members:

.. automodule:: vws.types
:undoc-members:
:members:
7 changes: 0 additions & 7 deletions docs/source/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,3 @@ Custom exceptions
:show-inheritance:
:inherited-members: Exception
:exclude-members: errno, filename, filename2, strerror

Response
--------

.. automodule:: vws.exceptions.response
:undoc-members:
:members:
2 changes: 1 addition & 1 deletion src/vws/exceptions/base_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from beartype import beartype

from .response import Response
from vws.types import Response


@beartype
Expand Down
2 changes: 1 addition & 1 deletion src/vws/exceptions/custom_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from beartype import beartype

from .response import Response
from vws.types import Response


@beartype
Expand Down
3 changes: 2 additions & 1 deletion src/vws/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
RequestEntityTooLargeError,
ServerError,
)
from vws.exceptions.response import Response
from vws.include_target_data import CloudRecoIncludeTargetData
from vws.reports import QueryResult, TargetData
from vws.types import Response

_ImageType = io.BytesIO | BinaryIO

Expand Down Expand Up @@ -154,6 +154,7 @@ def query(
status_code=requests_response.status_code,
headers=dict(requests_response.headers),
request_body=requests_response.request.body,
raw=requests_response.raw,
)

if response.status_code == HTTPStatus.REQUEST_ENTITY_TOO_LARGE:
Expand Down
3 changes: 2 additions & 1 deletion src/vws/exceptions/response.py → src/vws/types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Responses for exceptions."""
"""Responses for requests to VWS and VWQ."""

from dataclasses import dataclass

Expand All @@ -17,3 +17,4 @@ class Response:
status_code: int
headers: dict[str, str]
request_body: bytes | str | None
raw: bytes
4 changes: 2 additions & 2 deletions src/vws/vws.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
TargetStatuses,
TargetSummaryReport,
)

from .exceptions.response import Response
from vws.types import Response

_ImageType = io.BytesIO | BinaryIO

Expand Down Expand Up @@ -126,6 +125,7 @@ def _target_api_request(
status_code=requests_response.status_code,
headers=dict(requests_response.headers),
request_body=requests_response.request.body,
raw=requests_response.raw,
)


Expand Down