forked from loafle/openapi-generator-original
[python] Add default Configuration (#6554)
* Add default configuration * Fix assert_hostname bug in rest.py * Update petstore sample
This commit is contained in:
@@ -15,15 +15,30 @@ from __future__ import absolute_import
|
||||
|
||||
import urllib3
|
||||
|
||||
import copy
|
||||
import logging
|
||||
import multiprocessing
|
||||
import sys
|
||||
|
||||
from six import iteritems
|
||||
from six import with_metaclass
|
||||
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.
|
||||
Ref: https://github.com/swagger-api/swagger-codegen
|
||||
|
||||
@@ -78,7 +78,7 @@ class RESTClientObject(object):
|
||||
|
||||
addition_pool_args = {}
|
||||
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 configuration.connection_pool_maxsize is not None:
|
||||
|
||||
Reference in New Issue
Block a user