示例#1
0
def head(url):
    _setup_s3_connection()

    bucket, key = _split_url(url)
    s3_bucket = s3.get_bucket(bucket, validate=False)
    if s3_bucket and s3_bucket.get_key(key):
        return True
    return False
示例#2
0
文件: blob.py 项目: biochimia/hc2000
def head(url):
    _setup_s3_connection()

    bucket, key = _split_url(url)
    s3_bucket = s3.get_bucket(bucket, validate=False)
    if s3_bucket and s3_bucket.get_key(key):
        return True
    return False
示例#3
0
def list(url):
    _setup_s3_connection()

    bucket, key = _split_url(url)
    if not bucket:
        return [bucket.name.encode('utf-8') for bucket in s3.get_all_buckets()]
    else:
        bucket = s3.get_bucket(bucket, validate=False)
        return [('s3://%s/%s' % (key.bucket.name, key.name)).encode('utf-8')
                for key in bucket.get_all_keys(prefix=key)]
示例#4
0
文件: blob.py 项目: biochimia/hc2000
def list(url):
    _setup_s3_connection()

    bucket, key = _split_url(url)
    if not bucket:
        return [ bucket.name.encode('utf-8')
                for bucket in s3.get_all_buckets() ]
    else:
        bucket = s3.get_bucket(bucket, validate=False)
        return [ ('s3://%s/%s' % (key.bucket.name, key.name)).encode('utf-8')
                for key in bucket.get_all_keys(prefix=key) ]
示例#5
0
def _get_key(url):
    bucket, key = _split_url(url)
    return s3.get_bucket(bucket, validate=False).new_key(key)
示例#6
0
文件: blob.py 项目: biochimia/hc2000
def _get_key(url):
    bucket, key = _split_url(url)
    return s3.get_bucket(bucket, validate=False).new_key(key)