Skip to content

Commit 9c21c0c

Browse files
committed
Add verify_ssl option to generated Client, use it in each api
1 parent 6108b97 commit 9c21c0c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

openapi_python_client/templates/client.py.jinja

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from typing import Dict
2-
1+
import ssl
2+
from typing import Dict, Union
33
import attr
44

55
@attr.s(auto_attribs=True)
@@ -10,6 +10,7 @@ class Client:
1010
cookies: Dict[str, str] = attr.ib(factory=dict, kw_only=True)
1111
headers: Dict[str, str] = attr.ib(factory=dict, kw_only=True)
1212
timeout: float = attr.ib(5.0, kw_only=True)
13+
verify_ssl: Union[str, bool, ssl.SSLContext] = attr.ib(True, kw_only=True)
1314

1415
def get_headers(self) -> Dict[str, str]:
1516
""" 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
@@ -52,6 +52,7 @@ def _get_kwargs(
5252
{% if endpoint.query_parameters %}
5353
"params": params,
5454
{% endif %}
55+
"verify": client.verify_ssl,
5556
}
5657

5758

0 commit comments

Comments
 (0)