Skip to content

Commit c2f4115

Browse files
committed
Added support of follow HTTP redirects
1 parent f741d81 commit c2f4115

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

openapi_python_client/templates/client.py.jinja

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Client:
1616
but can be set to False for testing purposes.
1717
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
1818
status code that was not documented in the source OpenAPI document.
19+
follow_redirects: Whether or not to follow redirects. Default value is False.
1920
"""
2021

2122
base_url: str
@@ -24,6 +25,7 @@ class Client:
2425
timeout: float = attr.ib(5.0, kw_only=True)
2526
verify_ssl: Union[str, bool, ssl.SSLContext] = attr.ib(True, kw_only=True)
2627
raise_on_unexpected_status: bool = attr.ib(False, kw_only=True)
28+
follow_redirects: bool = attr.ib(False, kw_only=True)
2729

2830
def get_headers(self) -> Dict[str, str]:
2931
""" Get headers to be used in all endpoints """

openapi_python_client/templates/endpoint_module.py.jinja

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def _get_kwargs(
4646
"headers": headers,
4747
"cookies": cookies,
4848
"timeout": client.get_timeout(),
49+
"follow_redirects": client.follow_redirects,
4950
{% if endpoint.form_body %}
5051
"data": form_data.to_dict(),
5152
{% elif endpoint.multipart_body %}

0 commit comments

Comments
 (0)