示例#1
0
    def __init__(
        self,
        configuration=None,
        baseUrl=None,
        terminal_code=None,
        password=None,
        callback_secret=None,
        debug=False,
    ):

        if configuration is None:
            configuration = Configuration(
                base_url=baseUrl,
                terminal_code=terminal_code,
                password=password,
                callback_secret=callback_secret,
                debug=debug,
            )

        self.configuration = configuration

        # Use the pool property to lazily initialize the ThreadPool.
        self._pool = None
        self.rest_client = rest.RESTClientObject(configuration)
        self.default_headers = {}
        self.tokens = None
        self.cookie = None

        # Set default User-Agent.
        self.user_agent = "CardpaySdk/2.28.0/Python"
示例#2
0
 def create(cls, configuration, pools_size=4, maxsize=None):
     if not configuration.proxy or not os.getenv("NO_PROXY"):
         return rest.RESTClientObject(configuration, pools_size, maxsize)
     else:
         return cls(configuration, pools_size, maxsize)
示例#3
0
 def __init__(self, configuration, pool_size=4, maxsize=None):
     super().__init__(configuration, pool_size, maxsize)
     self.no_proxy_rest = rest.RESTClientObject(
         self._no_proxy_config(configuration), pool_size, maxsize
     )