How to use the jwplatform.client.RetryAdapter function in jwplatform

To help you get started, we’ve selected a few jwplatform examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jwplayer / jwplatform-py / jwplatform / client.py View on Github external
def __init__(self, *args, **kwargs):
        super(RetryAdapter, self).__init__(*args, **kwargs)
        self.max_retries = Retry(total=RETRY_COUNT,
                                 backoff_factor=BACKOFF_FACTOR)
github jwplayer / jwplatform-py / jwplatform / client.py View on Github external
def __init__(self, key, secret, *args, **kwargs):
        self.__key = key
        self.__secret = secret

        self._scheme = kwargs.get('scheme') or 'https'
        self._host = kwargs.get('host') or 'api.jwplatform.com'
        self._port = int(kwargs['port']) if kwargs.get('port') else 443
        self._api_version = kwargs.get('version') or 'v1'
        self._agent = kwargs.get('agent')

        self._connection = requests.Session()
        self._connection.mount(self._scheme, RetryAdapter())

        self._connection.headers['User-Agent'] = 'python-jwplatform/{}{}'.format(
            __version__, '-{}'.format(self._agent) if self._agent else '')