def _perform_request(self, request):
        ''' Sends the request and return response. Catches HTTPError and hand it to error handler'''

        try:
            if self._batchclient is not None:
                return self._batchclient.insert_request_to_batch(request)
            else:
                resp = self._filter(request)
        except HTTPError as e:
            _storage_error_handler(e)

        return resp
Beispiel #2
0
    def _perform_request(self, request):
        ''' Sends the request and return response. Catches HTTPError and hand it to error handler'''

        try:
            if self._batchclient is not None:
                return self._batchclient.insert_request_to_batch(request)
            else:
                resp = self._filter(request)
        except HTTPError as e:
            _storage_error_handler(e)

        return resp
    def _perform_request(self, request, text_encoding='utf-8'):
        '''
        Sends the request and return response. Catches HTTPError and hand it 
        to error handler
        '''
        try:
            if self._batchclient is not None:
                return self._batchclient.insert_request_to_batch(request)
            else:
                resp = self._filter(request)

            if sys.version_info >= (3,) and isinstance(resp, bytes) and text_encoding:
                resp = resp.decode(text_encoding)

        except HTTPError as e:
            _storage_error_handler(e)

        return resp
    def _perform_request(self, request, text_encoding='utf-8'):
        '''
        Sends the request and return response. Catches HTTPError and hand it
        to error handler
        '''
        try:
            if self._batchclient is not None:
                return self._batchclient.insert_request_to_batch(request)
            else:
                resp = self._filter(request)

            if sys.version_info >= (3,) and isinstance(resp, bytes) and \
                text_encoding:
                resp = resp.decode(text_encoding)

        except HTTPError as ex:
            _storage_error_handler(ex)

        return resp