def _swift_call(self, region, action, *args, **kwargs):
        try:
            region_name = region.name
        except AttributeError:
            region_name = region
        retries = 0
        while retries < 3:
            if region_name not in self.swifts:
                self.swifts[region_name] = self._get_swift_client(region_name)

            swift = self.swifts[region_name]['client']
            call = getattr(swift, action.lower())
            try:
                return call(*args, **kwargs)
            except swiftclient.exceptions.ClientException as e:
                if e.http_status == 401:
                    # Token is invalid, regenerate swift clients
                    del self.swifts[region_name]
                if e.http_status == 404:
                    raise ResourceNotFoundError(msg=e.msg)
                else:
                   raise e
        raise APIError(msg='Impossible to get a valid token')
Wrap calls to swiftclient to allow retry.
dataset/ETHPy150Open runabove/python-runabove/runabove/storage.py/ContainerManager._swift_call