Skip to content

Commit 7948103

Browse files
committed
samples
1 parent 63b3e27 commit 7948103

9 files changed

Lines changed: 312 additions & 111 deletions

File tree

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/openapi_client/configuration.py

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,25 @@ class Configuration:
158158
string values to replace variables in templated server configuration.
159159
The validation of enums is performed for variables with defined enum
160160
values before.
161+
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
162+
when calling API from https server.
161163
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
162164
in PEM format.
163165
:param retries: int | urllib3.util.retry.Retry - Retry configuration.
164166
:param ca_cert_data: verify the peer using concatenated CA certificate data
165167
in PEM (str) or DER (bytes) format.
166168
:param cert_file: the path to a client certificate file, for mTLS.
167169
:param key_file: the path to a client key file, for mTLS.
170+
:param assert_hostname: Set this to True/False to enable/disable SSL hostname verification.
171+
:param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server.
172+
:param connection_pool_maxsize: Connection pool max size. Defaults to 100 for async, cpu_count * 5 for sync.
173+
:param proxy: Proxy URL.
174+
:param proxy_headers: Proxy headers.
175+
:param safe_chars_for_path_param: Safe characters for path parameter encoding.
176+
:param client_side_validation: Enable client-side validation. Default True.
177+
:param socket_options: Options to pass down to the underlying urllib3 socket.
178+
:param datetime_format: Datetime format string for serialization.
179+
:param date_format: Date format string for serialization.
168180
169181
:Example:
170182
@@ -200,11 +212,22 @@ def __init__(
200212
server_operation_index: Optional[Dict[int, int]]=None,
201213
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
202214
ignore_operation_servers: bool=False,
215+
verify_ssl: bool=True,
203216
ssl_ca_cert: Optional[str]=None,
204217
retries: Optional[Union[int, Any]] = None,
205218
ca_cert_data: Optional[Union[str, bytes]] = None,
206219
cert_file: Optional[str]=None,
207220
key_file: Optional[str]=None,
221+
assert_hostname: Optional[bool]=None,
222+
tls_server_name: Optional[str]=None,
223+
connection_pool_maxsize: Optional[int]=None,
224+
proxy: Optional[str]=None,
225+
proxy_headers: Optional[Any]=None,
226+
safe_chars_for_path_param: str='',
227+
client_side_validation: bool=True,
228+
socket_options: Optional[Any]=None,
229+
datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
230+
date_format: str="%Y-%m-%d",
208231
*,
209232
debug: Optional[bool] = None,
210233
) -> None:
@@ -274,7 +297,7 @@ def __init__(
274297
"""Debug switch
275298
"""
276299

277-
self.verify_ssl = True
300+
self.verify_ssl = verify_ssl
278301
"""SSL/TLS verification
279302
Set this to false to skip verifying SSL certificate when calling API
280303
from https server.
@@ -292,46 +315,46 @@ def __init__(
292315
self.key_file = key_file
293316
"""client key file
294317
"""
295-
self.assert_hostname = None
318+
self.assert_hostname = assert_hostname
296319
"""Set this to True/False to enable/disable SSL hostname verification.
297320
"""
298-
self.tls_server_name = None
321+
self.tls_server_name = tls_server_name
299322
"""SSL/TLS Server Name Indication (SNI)
300323
Set this to the SNI value expected by the server.
301324
"""
302325

303-
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
326+
self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else multiprocessing.cpu_count() * 5
304327
"""urllib3 connection pool's maximum number of connections saved
305328
per pool. urllib3 uses 1 connection as default value, but this is
306329
not the best value when you are making a lot of possibly parallel
307330
requests to the same host, which is often the case here.
308331
cpu_count * 5 is used as default value to increase performance.
309332
"""
310333

311-
self.proxy: Optional[str] = None
334+
self.proxy = proxy
312335
"""Proxy URL
313336
"""
314-
self.proxy_headers = None
337+
self.proxy_headers = proxy_headers
315338
"""Proxy headers
316339
"""
317-
self.safe_chars_for_path_param = ''
340+
self.safe_chars_for_path_param = safe_chars_for_path_param
318341
"""Safe chars for path_param
319342
"""
320343
self.retries = retries
321344
"""Retry configuration
322345
"""
323346
# Enable client side validation
324-
self.client_side_validation = True
347+
self.client_side_validation = client_side_validation
325348

326-
self.socket_options = None
349+
self.socket_options = socket_options
327350
"""Options to pass down to the underlying urllib3 socket
328351
"""
329352

330-
self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
353+
self.datetime_format = datetime_format
331354
"""datetime format
332355
"""
333356

334-
self.date_format = "%Y-%m-%d"
357+
self.date_format = date_format
335358
"""date format
336359
"""
337360

samples/client/echo_api/python-pydantic-v1/openapi_client/configuration.py

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,23 @@ class Configuration:
5151
string values to replace variables in templated server configuration.
5252
The validation of enums is performed for variables with defined enum
5353
values before.
54+
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
55+
when calling API from https server.
5456
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
5557
in PEM format.
58+
:param retries: Retry configuration (e.g. urllib3.util.retry.Retry).
59+
:param cert_file: The path to a client certificate file, for mTLS.
60+
:param key_file: The path to a client key file, for mTLS.
61+
:param assert_hostname: Set this to True/False to enable/disable SSL hostname verification.
62+
:param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server.
63+
:param connection_pool_maxsize: Connection pool max size. Defaults to 100 for asyncio, cpu_count * 5 for sync.
64+
:param proxy: Proxy URL.
65+
:param proxy_headers: Proxy headers.
66+
:param safe_chars_for_path_param: Safe characters for path parameter encoding.
67+
:param client_side_validation: Enable client-side validation. Default True.
68+
:param socket_options: Options to pass down to the underlying urllib3 socket.
69+
:param datetime_format: Datetime format string for serialization.
70+
:param date_format: Date format string for serialization.
5671
5772
:Example:
5873
@@ -81,7 +96,13 @@ def __init__(self, host=None,
8196
access_token=None,
8297
server_index=None, server_variables=None,
8398
server_operation_index=None, server_operation_variables=None,
84-
ssl_ca_cert=None,
99+
verify_ssl=True, ssl_ca_cert=None,
100+
retries=None, cert_file=None, key_file=None,
101+
assert_hostname=None, tls_server_name=None,
102+
connection_pool_maxsize=None, proxy=None, proxy_headers=None,
103+
safe_chars_for_path_param='', client_side_validation=True,
104+
socket_options=None,
105+
datetime_format="%Y-%m-%dT%H:%M:%S.%f%z", date_format="%Y-%m-%d",
85106
) -> None:
86107
"""Constructor
87108
"""
@@ -143,60 +164,60 @@ def __init__(self, host=None,
143164
"""Debug switch
144165
"""
145166

146-
self.verify_ssl = True
167+
self.verify_ssl = verify_ssl
147168
"""SSL/TLS verification
148169
Set this to false to skip verifying SSL certificate when calling API
149170
from https server.
150171
"""
151172
self.ssl_ca_cert = ssl_ca_cert
152173
"""Set this to customize the certificate file to verify the peer.
153174
"""
154-
self.cert_file = None
175+
self.cert_file = cert_file
155176
"""client certificate file
156177
"""
157-
self.key_file = None
178+
self.key_file = key_file
158179
"""client key file
159180
"""
160-
self.assert_hostname = None
181+
self.assert_hostname = assert_hostname
161182
"""Set this to True/False to enable/disable SSL hostname verification.
162183
"""
163-
self.tls_server_name = None
184+
self.tls_server_name = tls_server_name
164185
"""SSL/TLS Server Name Indication (SNI)
165186
Set this to the SNI value expected by the server.
166187
"""
167188

168-
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
189+
self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else multiprocessing.cpu_count() * 5
169190
"""urllib3 connection pool's maximum number of connections saved
170191
per pool. urllib3 uses 1 connection as default value, but this is
171192
not the best value when you are making a lot of possibly parallel
172193
requests to the same host, which is often the case here.
173194
cpu_count * 5 is used as default value to increase performance.
174195
"""
175196

176-
self.proxy = None
197+
self.proxy = proxy
177198
"""Proxy URL
178199
"""
179-
self.proxy_headers = None
200+
self.proxy_headers = proxy_headers
180201
"""Proxy headers
181202
"""
182-
self.safe_chars_for_path_param = ''
203+
self.safe_chars_for_path_param = safe_chars_for_path_param
183204
"""Safe chars for path_param
184205
"""
185-
self.retries = None
206+
self.retries = retries
186207
"""Adding retries to override urllib3 default value 3
187208
"""
188209
# Enable client side validation
189-
self.client_side_validation = True
210+
self.client_side_validation = client_side_validation
190211

191-
self.socket_options = None
212+
self.socket_options = socket_options
192213
"""Options to pass down to the underlying urllib3 socket
193214
"""
194215

195-
self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
216+
self.datetime_format = datetime_format
196217
"""datetime format
197218
"""
198219

199-
self.date_format = "%Y-%m-%d"
220+
self.date_format = date_format
200221
"""date format
201222
"""
202223

samples/client/echo_api/python/openapi_client/configuration.py

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,25 @@ class Configuration:
158158
string values to replace variables in templated server configuration.
159159
The validation of enums is performed for variables with defined enum
160160
values before.
161+
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
162+
when calling API from https server.
161163
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
162164
in PEM format.
163165
:param retries: int | urllib3.util.retry.Retry - Retry configuration.
164166
:param ca_cert_data: verify the peer using concatenated CA certificate data
165167
in PEM (str) or DER (bytes) format.
166168
:param cert_file: the path to a client certificate file, for mTLS.
167169
:param key_file: the path to a client key file, for mTLS.
170+
:param assert_hostname: Set this to True/False to enable/disable SSL hostname verification.
171+
:param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server.
172+
:param connection_pool_maxsize: Connection pool max size. Defaults to 100 for async, cpu_count * 5 for sync.
173+
:param proxy: Proxy URL.
174+
:param proxy_headers: Proxy headers.
175+
:param safe_chars_for_path_param: Safe characters for path parameter encoding.
176+
:param client_side_validation: Enable client-side validation. Default True.
177+
:param socket_options: Options to pass down to the underlying urllib3 socket.
178+
:param datetime_format: Datetime format string for serialization.
179+
:param date_format: Date format string for serialization.
168180
169181
:Example:
170182
@@ -200,11 +212,22 @@ def __init__(
200212
server_operation_index: Optional[Dict[int, int]]=None,
201213
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
202214
ignore_operation_servers: bool=False,
215+
verify_ssl: bool=True,
203216
ssl_ca_cert: Optional[str]=None,
204217
retries: Optional[Union[int, Any]] = None,
205218
ca_cert_data: Optional[Union[str, bytes]] = None,
206219
cert_file: Optional[str]=None,
207220
key_file: Optional[str]=None,
221+
assert_hostname: Optional[bool]=None,
222+
tls_server_name: Optional[str]=None,
223+
connection_pool_maxsize: Optional[int]=None,
224+
proxy: Optional[str]=None,
225+
proxy_headers: Optional[Any]=None,
226+
safe_chars_for_path_param: str='',
227+
client_side_validation: bool=True,
228+
socket_options: Optional[Any]=None,
229+
datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
230+
date_format: str="%Y-%m-%d",
208231
*,
209232
debug: Optional[bool] = None,
210233
) -> None:
@@ -274,7 +297,7 @@ def __init__(
274297
"""Debug switch
275298
"""
276299

277-
self.verify_ssl = True
300+
self.verify_ssl = verify_ssl
278301
"""SSL/TLS verification
279302
Set this to false to skip verifying SSL certificate when calling API
280303
from https server.
@@ -292,46 +315,46 @@ def __init__(
292315
self.key_file = key_file
293316
"""client key file
294317
"""
295-
self.assert_hostname = None
318+
self.assert_hostname = assert_hostname
296319
"""Set this to True/False to enable/disable SSL hostname verification.
297320
"""
298-
self.tls_server_name = None
321+
self.tls_server_name = tls_server_name
299322
"""SSL/TLS Server Name Indication (SNI)
300323
Set this to the SNI value expected by the server.
301324
"""
302325

303-
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
326+
self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else multiprocessing.cpu_count() * 5
304327
"""urllib3 connection pool's maximum number of connections saved
305328
per pool. urllib3 uses 1 connection as default value, but this is
306329
not the best value when you are making a lot of possibly parallel
307330
requests to the same host, which is often the case here.
308331
cpu_count * 5 is used as default value to increase performance.
309332
"""
310333

311-
self.proxy: Optional[str] = None
334+
self.proxy = proxy
312335
"""Proxy URL
313336
"""
314-
self.proxy_headers = None
337+
self.proxy_headers = proxy_headers
315338
"""Proxy headers
316339
"""
317-
self.safe_chars_for_path_param = ''
340+
self.safe_chars_for_path_param = safe_chars_for_path_param
318341
"""Safe chars for path_param
319342
"""
320343
self.retries = retries
321344
"""Retry configuration
322345
"""
323346
# Enable client side validation
324-
self.client_side_validation = True
347+
self.client_side_validation = client_side_validation
325348

326-
self.socket_options = None
349+
self.socket_options = socket_options
327350
"""Options to pass down to the underlying urllib3 socket
328351
"""
329352

330-
self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
353+
self.datetime_format = datetime_format
331354
"""datetime format
332355
"""
333356

334-
self.date_format = "%Y-%m-%d"
357+
self.date_format = date_format
335358
"""date format
336359
"""
337360

0 commit comments

Comments
 (0)