mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-10 09:06:13 +00:00
[python] Add default Configuration (#6554)
* Add default configuration * Fix assert_hostname bug in rest.py * Update petstore sample
This commit is contained in:
@@ -6,15 +6,30 @@ from __future__ import absolute_import
|
|||||||
|
|
||||||
import urllib3
|
import urllib3
|
||||||
|
|
||||||
|
import copy
|
||||||
import logging
|
import logging
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
from six import with_metaclass
|
||||||
from six.moves import http_client as httplib
|
from six.moves import http_client as httplib
|
||||||
|
|
||||||
|
class TypeWithDefault(type):
|
||||||
|
def __init__(cls, name, bases, dct):
|
||||||
|
super(TypeWithDefault, cls).__init__(name, bases, dct)
|
||||||
|
cls._default = None
|
||||||
|
|
||||||
class Configuration(object):
|
def __call__(cls):
|
||||||
|
if cls._default == None:
|
||||||
|
cls._default = type.__call__(cls)
|
||||||
|
return copy.copy(cls._default)
|
||||||
|
|
||||||
|
def set_default(cls, default):
|
||||||
|
cls._default = copy.copy(default)
|
||||||
|
|
||||||
|
|
||||||
|
class Configuration(with_metaclass(TypeWithDefault, object)):
|
||||||
"""
|
"""
|
||||||
NOTE: This class is auto generated by the swagger code generator program.
|
NOTE: This class is auto generated by the swagger code generator program.
|
||||||
Ref: https://github.com/swagger-api/swagger-codegen
|
Ref: https://github.com/swagger-api/swagger-codegen
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ class RESTClientObject(object):
|
|||||||
|
|
||||||
addition_pool_args = {}
|
addition_pool_args = {}
|
||||||
if configuration.assert_hostname is not None:
|
if configuration.assert_hostname is not None:
|
||||||
addition_pool_args['assert_hostname'] = config.assert_hostname
|
addition_pool_args['assert_hostname'] = configuration.assert_hostname
|
||||||
|
|
||||||
if maxsize is None:
|
if maxsize is None:
|
||||||
if configuration.connection_pool_maxsize is not None:
|
if configuration.connection_pool_maxsize is not None:
|
||||||
|
|||||||
@@ -15,15 +15,30 @@ from __future__ import absolute_import
|
|||||||
|
|
||||||
import urllib3
|
import urllib3
|
||||||
|
|
||||||
|
import copy
|
||||||
import logging
|
import logging
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
from six import with_metaclass
|
||||||
from six.moves import http_client as httplib
|
from six.moves import http_client as httplib
|
||||||
|
|
||||||
|
class TypeWithDefault(type):
|
||||||
|
def __init__(cls, name, bases, dct):
|
||||||
|
super(TypeWithDefault, cls).__init__(name, bases, dct)
|
||||||
|
cls._default = None
|
||||||
|
|
||||||
class Configuration(object):
|
def __call__(cls):
|
||||||
|
if cls._default == None:
|
||||||
|
cls._default = type.__call__(cls)
|
||||||
|
return copy.copy(cls._default)
|
||||||
|
|
||||||
|
def set_default(cls, default):
|
||||||
|
cls._default = copy.copy(default)
|
||||||
|
|
||||||
|
|
||||||
|
class Configuration(with_metaclass(TypeWithDefault, object)):
|
||||||
"""
|
"""
|
||||||
NOTE: This class is auto generated by the swagger code generator program.
|
NOTE: This class is auto generated by the swagger code generator program.
|
||||||
Ref: https://github.com/swagger-api/swagger-codegen
|
Ref: https://github.com/swagger-api/swagger-codegen
|
||||||
|
|||||||
@@ -15,15 +15,30 @@ from __future__ import absolute_import
|
|||||||
|
|
||||||
import urllib3
|
import urllib3
|
||||||
|
|
||||||
|
import copy
|
||||||
import logging
|
import logging
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
from six import with_metaclass
|
||||||
from six.moves import http_client as httplib
|
from six.moves import http_client as httplib
|
||||||
|
|
||||||
|
class TypeWithDefault(type):
|
||||||
|
def __init__(cls, name, bases, dct):
|
||||||
|
super(TypeWithDefault, cls).__init__(name, bases, dct)
|
||||||
|
cls._default = None
|
||||||
|
|
||||||
class Configuration(object):
|
def __call__(cls):
|
||||||
|
if cls._default == None:
|
||||||
|
cls._default = type.__call__(cls)
|
||||||
|
return copy.copy(cls._default)
|
||||||
|
|
||||||
|
def set_default(cls, default):
|
||||||
|
cls._default = copy.copy(default)
|
||||||
|
|
||||||
|
|
||||||
|
class Configuration(with_metaclass(TypeWithDefault, object)):
|
||||||
"""
|
"""
|
||||||
NOTE: This class is auto generated by the swagger code generator program.
|
NOTE: This class is auto generated by the swagger code generator program.
|
||||||
Ref: https://github.com/swagger-api/swagger-codegen
|
Ref: https://github.com/swagger-api/swagger-codegen
|
||||||
|
|||||||
@@ -15,15 +15,30 @@ from __future__ import absolute_import
|
|||||||
|
|
||||||
import urllib3
|
import urllib3
|
||||||
|
|
||||||
|
import copy
|
||||||
import logging
|
import logging
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from six import iteritems
|
from six import iteritems
|
||||||
|
from six import with_metaclass
|
||||||
from six.moves import http_client as httplib
|
from six.moves import http_client as httplib
|
||||||
|
|
||||||
|
class TypeWithDefault(type):
|
||||||
|
def __init__(cls, name, bases, dct):
|
||||||
|
super(TypeWithDefault, cls).__init__(name, bases, dct)
|
||||||
|
cls._default = None
|
||||||
|
|
||||||
class Configuration(object):
|
def __call__(cls):
|
||||||
|
if cls._default == None:
|
||||||
|
cls._default = type.__call__(cls)
|
||||||
|
return copy.copy(cls._default)
|
||||||
|
|
||||||
|
def set_default(cls, default):
|
||||||
|
cls._default = copy.copy(default)
|
||||||
|
|
||||||
|
|
||||||
|
class Configuration(with_metaclass(TypeWithDefault, object)):
|
||||||
"""
|
"""
|
||||||
NOTE: This class is auto generated by the swagger code generator program.
|
NOTE: This class is auto generated by the swagger code generator program.
|
||||||
Ref: https://github.com/swagger-api/swagger-codegen
|
Ref: https://github.com/swagger-api/swagger-codegen
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ class RESTClientObject(object):
|
|||||||
|
|
||||||
addition_pool_args = {}
|
addition_pool_args = {}
|
||||||
if configuration.assert_hostname is not None:
|
if configuration.assert_hostname is not None:
|
||||||
addition_pool_args['assert_hostname'] = config.assert_hostname
|
addition_pool_args['assert_hostname'] = configuration.assert_hostname
|
||||||
|
|
||||||
if maxsize is None:
|
if maxsize is None:
|
||||||
if configuration.connection_pool_maxsize is not None:
|
if configuration.connection_pool_maxsize is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user