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
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class RESTClientObject:
self.ssl_context.check_hostname = False
self.ssl_context.verify_mode = ssl.CERT_NONE

if configuration.disable_strict_ssl_verification:
self.ssl_context.verify_flags &= ~ssl.VERIFY_X509_STRICT
self.proxy = configuration.proxy
self.proxy_headers = configuration.proxy_headers

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ class Configuration:
values before.
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
when calling API from https server.
:param disable_strict_ssl_verification: bool - Set this to true to disable strict X.509 certificate verification.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
{{#asyncio}}
Expand Down Expand Up @@ -375,6 +376,7 @@ conf = {{{packageName}}}.Configuration(
socket_options: Optional[Any]=None,
datetime_format: str="{{{datetimeFormat}}}",
date_format: str="{{{dateFormat}}}",
disable_strict_ssl_verification: bool=False,
*,
debug: Optional[bool] = None,
) -> None:
Expand Down Expand Up @@ -454,6 +456,7 @@ conf = {{{packageName}}}.Configuration(
"""

self.verify_ssl = verify_ssl
self.disable_strict_ssl_verification = disable_strict_ssl_verification
Comment thread
Vishwa0223 marked this conversation as resolved.
"""SSL/TLS verification
Set this to false to skip verifying SSL certificate when calling API
from https server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class RESTClientObject:
self.ssl_context.check_hostname = False
self.ssl_context.verify_mode = ssl.CERT_NONE

if configuration.disable_strict_ssl_verification:
self.ssl_context.verify_flags &= ~ssl.VERIFY_X509_STRICT
self.proxy = configuration.proxy
self.proxy_headers = configuration.proxy_headers

Expand Down
10 changes: 10 additions & 0 deletions modules/openapi-generator/src/main/resources/python/rest.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ class RESTClientObject:
configuration.assert_hostname
)

if configuration.disable_strict_ssl_verification:
ssl_context = ssl.create_default_context(
cafile=configuration.ssl_ca_cert,
cadata=configuration.ca_cert_data,
)
if not configuration.verify_ssl:
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
ssl_context.verify_flags &= ~ssl.VERIFY_X509_STRICT
pool_args['ssl_context'] = ssl_context
Comment thread
Vishwa0223 marked this conversation as resolved.
if configuration.retries is not None:
pool_args['retries'] = configuration.retries

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class Configuration:
values before.
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
when calling API from https server.
:param disable_strict_ssl_verification: bool - Set this to true to disable strict X.509 certificate verification.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: int | urllib3.util.retry.Retry - Retry configuration.
Expand Down Expand Up @@ -235,6 +236,7 @@ def __init__(
socket_options: Optional[Any]=None,
datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
date_format: str="%Y-%m-%d",
disable_strict_ssl_verification: bool=False,
*,
debug: Optional[bool] = None,
) -> None:
Expand Down Expand Up @@ -305,6 +307,7 @@ def __init__(
"""

self.verify_ssl = verify_ssl
self.disable_strict_ssl_verification = disable_strict_ssl_verification
"""SSL/TLS verification
Set this to false to skip verifying SSL certificate when calling API
from https server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ def __init__(self, configuration) -> None:
configuration.assert_hostname
)

if configuration.disable_strict_ssl_verification:
ssl_context = ssl.create_default_context(
cafile=configuration.ssl_ca_cert,
cadata=configuration.ca_cert_data,
)
ssl_context.verify_flags &= ~ssl.VERIFY_X509_STRICT
pool_args['ssl_context'] = ssl_context
if configuration.retries is not None:
pool_args['retries'] = configuration.retries

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ class Configuration:
values before.
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
when calling API from https server.
:param disable_strict_ssl_verification: bool - Set this to true to disable strict X.509 certificate verification.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: int | urllib3.util.retry.Retry - Retry configuration.
Expand Down Expand Up @@ -235,6 +236,7 @@ def __init__(
socket_options: Optional[Any]=None,
datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
date_format: str="%Y-%m-%d",
disable_strict_ssl_verification: bool=False,
*,
debug: Optional[bool] = None,
) -> None:
Expand Down Expand Up @@ -305,6 +307,7 @@ def __init__(
"""

self.verify_ssl = verify_ssl
self.disable_strict_ssl_verification = disable_strict_ssl_verification
"""SSL/TLS verification
Set this to false to skip verifying SSL certificate when calling API
from https server.
Expand Down
10 changes: 10 additions & 0 deletions samples/client/echo_api/python/openapi_client/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,16 @@ def __init__(self, configuration) -> None:
configuration.assert_hostname
)

if configuration.disable_strict_ssl_verification:
ssl_context = ssl.create_default_context(
cafile=configuration.ssl_ca_cert,
cadata=configuration.ca_cert_data,
)
if not configuration.verify_ssl:
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
ssl_context.verify_flags &= ~ssl.VERIFY_X509_STRICT
pool_args['ssl_context'] = ssl_context
if configuration.retries is not None:
pool_args['retries'] = configuration.retries

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class Configuration:
values before.
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
when calling API from https server.
:param disable_strict_ssl_verification: bool - Set this to true to disable strict X.509 certificate verification.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: int | urllib3.util.retry.Retry - Retry configuration.
Expand Down Expand Up @@ -215,6 +216,7 @@ def __init__(
socket_options: Optional[Any]=None,
datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
date_format: str="%Y-%m-%d",
disable_strict_ssl_verification: bool=False,
*,
debug: Optional[bool] = None,
) -> None:
Expand Down Expand Up @@ -285,6 +287,7 @@ def __init__(
"""

self.verify_ssl = verify_ssl
self.disable_strict_ssl_verification = disable_strict_ssl_verification
"""SSL/TLS verification
Set this to false to skip verifying SSL certificate when calling API
from https server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ def __init__(self, configuration) -> None:
configuration.assert_hostname
)

if configuration.disable_strict_ssl_verification:
ssl_context = ssl.create_default_context(
cafile=configuration.ssl_ca_cert,
cadata=configuration.ca_cert_data,
)
ssl_context.verify_flags &= ~ssl.VERIFY_X509_STRICT
pool_args['ssl_context'] = ssl_context
if configuration.retries is not None:
pool_args['retries'] = configuration.retries

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ class Configuration:
values before.
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
when calling API from https server.
:param disable_strict_ssl_verification: bool - Set this to true to disable strict X.509 certificate verification.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: int | aiohttp_retry.RetryOptionsBase - Retry configuration.
Expand Down Expand Up @@ -306,6 +307,7 @@ def __init__(
socket_options: Optional[Any]=None,
datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
date_format: str="%Y-%m-%d",
disable_strict_ssl_verification: bool=False,
*,
debug: Optional[bool] = None,
) -> None:
Expand Down Expand Up @@ -380,6 +382,7 @@ def __init__(
"""

self.verify_ssl = verify_ssl
self.disable_strict_ssl_verification = disable_strict_ssl_verification
"""SSL/TLS verification
Set this to false to skip verifying SSL certificate when calling API
from https server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def __init__(self, configuration) -> None:
self.ssl_context.check_hostname = False
self.ssl_context.verify_mode = ssl.CERT_NONE

if configuration.disable_strict_ssl_verification:
self.ssl_context.verify_flags &= ~ssl.VERIFY_X509_STRICT
self.proxy = configuration.proxy
self.proxy_headers = configuration.proxy_headers

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class Configuration:
values before.
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
when calling API from https server.
:param disable_strict_ssl_verification: bool - Set this to true to disable strict X.509 certificate verification.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: int - Retry configuration.
Expand Down Expand Up @@ -292,6 +293,7 @@ def __init__(
socket_options: Optional[Any]=None,
datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
date_format: str="%Y-%m-%d",
disable_strict_ssl_verification: bool=False,
*,
debug: Optional[bool] = None,
) -> None:
Expand Down Expand Up @@ -366,6 +368,7 @@ def __init__(
"""

self.verify_ssl = verify_ssl
self.disable_strict_ssl_verification = disable_strict_ssl_verification
"""SSL/TLS verification
Set this to false to skip verifying SSL certificate when calling API
from https server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def __init__(self, configuration) -> None:
self.ssl_context.check_hostname = False
self.ssl_context.verify_mode = ssl.CERT_NONE

if configuration.disable_strict_ssl_verification:
self.ssl_context.verify_flags &= ~ssl.VERIFY_X509_STRICT
self.proxy = configuration.proxy
self.proxy_headers = configuration.proxy_headers

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class Configuration:
values before.
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
when calling API from https server.
:param disable_strict_ssl_verification: bool - Set this to true to disable strict X.509 certificate verification.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: int - Retry configuration.
Expand Down Expand Up @@ -292,6 +293,7 @@ def __init__(
socket_options: Optional[Any]=None,
datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
date_format: str="%Y-%m-%d",
disable_strict_ssl_verification: bool=False,
*,
debug: Optional[bool] = None,
) -> None:
Expand Down Expand Up @@ -366,6 +368,7 @@ def __init__(
"""

self.verify_ssl = verify_ssl
self.disable_strict_ssl_verification = disable_strict_ssl_verification
"""SSL/TLS verification
Set this to false to skip verifying SSL certificate when calling API
from https server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ def __init__(self, configuration) -> None:
self.ssl_context.check_hostname = False
self.ssl_context.verify_mode = ssl.CERT_NONE

if configuration.disable_strict_ssl_verification:
self.ssl_context.verify_flags &= ~ssl.VERIFY_X509_STRICT
self.proxy = configuration.proxy
self.proxy_headers = configuration.proxy_headers

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class Configuration:
values before.
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
when calling API from https server.
:param disable_strict_ssl_verification: bool - Set this to true to disable strict X.509 certificate verification.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: int | urllib3.util.retry.Retry - Retry configuration.
Expand Down Expand Up @@ -300,6 +301,7 @@ def __init__(
socket_options: Optional[Any]=None,
datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
date_format: str="%Y-%m-%d",
disable_strict_ssl_verification: bool=False,
*,
debug: Optional[bool] = None,
) -> None:
Expand Down Expand Up @@ -375,6 +377,7 @@ def __init__(
"""

self.verify_ssl = verify_ssl
self.disable_strict_ssl_verification = disable_strict_ssl_verification
"""SSL/TLS verification
Set this to false to skip verifying SSL certificate when calling API
from https server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ def __init__(self, configuration) -> None:
configuration.assert_hostname
)

if configuration.disable_strict_ssl_verification:
ssl_context = ssl.create_default_context(
cafile=configuration.ssl_ca_cert,
cadata=configuration.ca_cert_data,
)
ssl_context.verify_flags &= ~ssl.VERIFY_X509_STRICT
pool_args['ssl_context'] = ssl_context
if configuration.retries is not None:
pool_args['retries'] = configuration.retries

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class Configuration:
values before.
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
when calling API from https server.
:param disable_strict_ssl_verification: bool - Set this to true to disable strict X.509 certificate verification.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: int | urllib3.util.retry.Retry - Retry configuration.
Expand Down Expand Up @@ -300,6 +301,7 @@ def __init__(
socket_options: Optional[Any]=None,
datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
date_format: str="%Y-%m-%d",
disable_strict_ssl_verification: bool=False,
*,
debug: Optional[bool] = None,
) -> None:
Expand Down Expand Up @@ -375,6 +377,7 @@ def __init__(
"""

self.verify_ssl = verify_ssl
self.disable_strict_ssl_verification = disable_strict_ssl_verification
"""SSL/TLS verification
Set this to false to skip verifying SSL certificate when calling API
from https server.
Expand Down
7 changes: 7 additions & 0 deletions samples/openapi3/client/petstore/python/petstore_api/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ def __init__(self, configuration) -> None:
configuration.assert_hostname
)

if configuration.disable_strict_ssl_verification:
ssl_context = ssl.create_default_context(
cafile=configuration.ssl_ca_cert,
cadata=configuration.ca_cert_data,
)
ssl_context.verify_flags &= ~ssl.VERIFY_X509_STRICT
pool_args['ssl_context'] = ssl_context
Comment thread
Vishwa0223 marked this conversation as resolved.
if configuration.retries is not None:
pool_args['retries'] = configuration.retries

Expand Down
Loading