X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/951149b9258803cb46162ceb78bbec0afae50a04..a7b16675337995c65b909a7519178efed98a3089:/sdk/python/arvados/api.py diff --git a/sdk/python/arvados/api.py b/sdk/python/arvados/api.py index 0803db85db..2f1f74044d 100644 --- a/sdk/python/arvados/api.py +++ b/sdk/python/arvados/api.py @@ -147,31 +147,3 @@ def api(version=None, cache=True, host=None, token=None, insecure=False, **kwarg svc.api_token = token kwargs['http'].cache = None return svc - -class SafeApi(object): - """Threadsafe wrapper for API object. This stores and returns a different api - object per thread, because httplib2 which underlies apiclient is not - threadsafe. - """ - - def __init__(self, config=None, keep_params={}): - if not config: - config = arvados.config.settings() - self.host = config.get('ARVADOS_API_HOST') - self.api_token = config.get('ARVADOS_API_TOKEN') - self.insecure = config.flag_is_true('ARVADOS_API_HOST_INSECURE') - self.local = threading.local() - self.keep = arvados.KeepClient(api_client=self, **keep_params) - - def localapi(self): - if 'api' not in self.local.__dict__: - self.local.api = arvados.api('v1', False, self.host, - self.api_token, self.insecure) - return self.local.api - - def __getattr__(self, name): - # Proxy nonexistent attributes to the thread-local API client. - try: - return getattr(self.localapi(), name) - except AttributeError: - return super(SafeApi, self).__getattr__(name)