Skip to content
Open
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
8 changes: 6 additions & 2 deletions openapi_python_client/templates/endpoint_module.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def _get_kwargs(
{% if endpoint.path_parameters %}
"url": "{{ endpoint.path }}".format(
{%- for parameter in endpoint.path_parameters -%}
{{parameter.python_name}}=quote(str({{parameter.python_name}}), safe=""),
{{parameter.python_name}}=\quote(str({{parameter.python_name}}), safe=\"\"),
{%- endfor -%}
),
{% else %}
Expand Down Expand Up @@ -99,8 +99,12 @@ def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Res


def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[{{ return_string }}]:
try:
status_code = HTTPStatus(response.status_code)
except ValueError:
status_code = response.status_code
return Response(
status_code=HTTPStatus(response.status_code),
status_code=status_code,
content=response.content,
headers=response.headers,
parsed=_parse_response(client=client, response=response),
Expand Down
2 changes: 1 addition & 1 deletion openapi_python_client/templates/types.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ T = TypeVar("T")
class Response(Generic[T]):
""" A response from an endpoint """

status_code: HTTPStatus
status_code: HTTPStatus | int
content: bytes
headers: MutableMapping[str, str]
parsed: T | None
Expand Down