How to use the tilecloud.lib.s3.S3Error function in tilecloud

To help you get started, we’ve selected a few tilecloud 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 camptocamp / tilecloud / tilecloud / lib / View on Github external
if 'x-amz-date' not in headers:
            headers['x-amz-date'] = \
                datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S +0000')
        if self.iam_token is not None:
            headers['x-amz-security-token'] = self.iam_token
        headers['Authorization'] = self.sign(method, bucket_name, url, headers,
        while True:
                if self.connection is None:
                    self.connection = httplib.HTTPConnection(
                self.connection.request(method, url, body, headers)
                response = self.connection.getresponse()
                if response.status not in xrange(200, 300):
                    raise S3Error(method, url, body, headers, response)
                headers = HeaderDict(response.getheaders())
                body =
                return (headers, body)
            except httplib.BadStatusLine as exc:
                self.connection = None
            except httplib.CannotSendRequest as exc:
                self.connection = None
            except ssl.SSLError as exc:
                self.connection = None
            except IOError as exc:
                if exc.errno == errno.ECONNRESET:
                    self.connection = None