diff --git a/api/api/products/aliyun.py b/api/api/products/aliyun.py index ebce041..0cafe04 100644 --- a/api/api/products/aliyun.py +++ b/api/api/products/aliyun.py @@ -20,6 +20,15 @@ def oss_get(name, bucket=None): except oss2.exceptions.NoSuchKey: return None +def oss_list(bucket): + ret = [] + for obj in oss_bucket(bucket).list_objects().object_list: + ret.append(obj.key) + return ret + +def oss_delete(name, bucket): + oss_bucket(bucket).delete_object(name) + def oss_sign_url(name, method='GET', bucket=None): return oss_bucket(bucket).sign_url(method, name.encode(), 24 * 60 * 60)