Skip to content

Commit e63d86b

Browse files
Merge pull request #8 from GDATAAdvancedAnalytics/add-verify
Make verify parameter configurable
2 parents 65dc87c + 2f7be35 commit e63d86b

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/openapi_python_generator/language_converters/python/templates/apiconfig.jinja2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{% if env_token_name is not none %}import os{% endif %}
22

3-
from typing import Optional
3+
from typing import Optional, Union
44

55
class APIConfig():
66
base_path: str = '{{ servers[0].url }}'
7+
verify: Union[bool, str] = True
78
{% if env_token_name is none %}
89
_access_token : Optional[str] = None
910
{% endif %}

src/openapi_python_generator/language_converters/python/templates/httpx.jinja2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
query_params = {key:value for (key,value) in query_params.items() if value is not None}
1616

1717
{% if async_client %}
18-
async with httpx.AsyncClient(base_url=base_path) as client:
18+
async with httpx.AsyncClient(base_url=base_path, verify=APIConfig.verify) as client:
1919
response = await client.request(
2020
{% else %}
21-
with httpx.Client(base_url=base_path) as client:
21+
with httpx.Client(base_url=base_path, verify=APIConfig.verify) as client:
2222
response = client.request(
2323
{% endif %}
2424
'{{ method }}',

src/openapi_python_generator/language_converters/python/templates/requests.jinja2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def {{ operation_id }}({{ params }}) -> {% if return_type.type is none or return
1919
f'{base_path}{path}',
2020
headers=headers,
2121
params=query_params,
22+
verify=APIConfig.verify,
2223
{% if body_param %}
2324
{% if use_orjson %}
2425
content=orjson.dumps({{ body_param }})

0 commit comments

Comments
 (0)