import oss2 class AliOss: AccessKeyId = 'LYu38mijwUW440A4' AccessKeySecret = '5yQum5XXdqlP9lx8YQojwyrciB0hu4' BucketName = 'shop-live' EndPoint = 'http://oss-cn-beijing-internal.aliyuncs.com/' BaseUrl = 'shop-live.oss-cn-beijing-internal.aliyuncs.com/shop_live/' @classmethod def get_auth_bucket(cls): # 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录 https://ram.console.aliyun.com 创建RAM账号。 auth = oss2.Auth(cls.AccessKeyId, cls.AccessKeySecret) # Endpoint以杭州为例,其它Region请按实际情况填写。 bucket = oss2.Bucket(auth, cls.EndPoint, cls.BucketName) return bucket