def open(cls, filename):
        """Return a handle like object for streaming from S3."""
        import boto
        file_info = cls.parse_remote(filename)
        connection = cls.connect(filename)
        try:
            s3_bucket = connection.get_bucket(file_info.bucket)
        except boto.exception.S3ResponseError as error:
            # if we don't have bucket permissions but folder permissions,
            # try without validation
            if error.status == 403:
                s3_bucket = connection.get_bucket(file_info.bucket,
                                                  validate=False)
            else:
                raise

        s3_key = s3_bucket.get_key(file_info.key)
        if s3_key is None:
            raise ValueError("Did not find S3 key: %s" % filename)
        return S3Handle(s3_key)
def open ( cls , filename ) : import boto file_info = cls . parse_remote ( filename ) connection = cls . connect ( filename ) try : s3_bucket = connection . get_bucket ( file_info . bucket ) except boto . exception . S3ResponseError as error : if error . status == 403 : s3_bucket = connection . get_bucket ( file_info . bucket , validate = False ) else : raise s3_key = s3_bucket . get_key ( file_info . key ) if s3_key is None : raise ValueError ( "Did not find S3 key: %s" % filename ) return S3Handle ( s3_key )
Return a handle like object for streaming from S3.