X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/7000c1ebd170001e10807b583a29e9e7e9570b23..29a6508d68cc93c376a8ba28559b7404933b5546:/sdk/python/arvados/api.py diff --git a/sdk/python/arvados/api.py b/sdk/python/arvados/api.py index e0d1c50f03..85d4197588 100644 --- a/sdk/python/arvados/api.py +++ b/sdk/python/arvados/api.py @@ -66,9 +66,6 @@ def _intercept_http_request(self, uri, method="GET", headers={}, **kwargs): self.max_request_size < len(kwargs['body'])): raise apiclient_errors.MediaUploadSizeError("Request size %i bytes exceeds published limit of %i bytes" % (len(kwargs['body']), self.max_request_size)) - if config.get("ARVADOS_EXTERNAL_CLIENT", "") == "true": - headers['X-External-Client'] = '1' - headers['Authorization'] = 'OAuth2 %s' % self.arvados_api_token retryable = method in [ @@ -133,6 +130,10 @@ def _patch_http_request(http, api_token): http._request_id = util.new_request_id return http +def _close_connections(self): + for conn in self._http.connections.values(): + conn.close() + # Monkey patch discovery._cast() so objects and arrays get serialized # with json.dumps() instead of str(). _cast_orig = apiclient_discovery._cast @@ -254,6 +255,7 @@ def api(version=None, cache=True, host=None, token=None, insecure=False, svc.request_id = request_id svc.config = lambda: util.get_config_once(svc) svc.vocabulary = lambda: util.get_vocabulary_once(svc) + svc.close_connections = types.MethodType(_close_connections, svc) kwargs['http'].max_request_size = svc._rootDesc.get('maxRequestSize', 0) kwargs['http'].cache = None kwargs['http']._request_id = lambda: svc.request_id or util.new_request_id()