上次的接口好像还能用,不知道大家给传了多少好东西 上次帖子https://91ai.net/thread-1197264-1-1.html 不限文件内容/格式/大小 测试图7mb post请求这个地址获取key http://f09.huainanpeiziapp.cn/serveapi/xlt/get/get/STS 数据 {"signature":"complaint"} 使用方法参考 https://91ai.net/thread-1197866-1-1.html 有好多种方法 接口, 上次, 阿里
帮MJJ大军加大火力,放个简洁Python版: [ol]import os, oss2, json, uuid, requests from oss2.credentials import EnvironmentVariableCredentialsProvider def test(yellow_video_path): j = requests.post(url="http://f09.huainanpeiziapp.cn/serveapi/xlt/get/get/STS", headers={'Content-Type': 'application/json'}, data=json.dumps({"signature":"complaint"})).json() os.environ["OSS_ACCESS_KEY_ID"] = j["data"]["tempAk"] os.environ["OSS_ACCESS_KEY_SECRET"] = j["data"]["tempSk"] os.environ["OSS_SESSION_TOKEN"] = j["data"]["token"] auth = oss2.ProviderAuth(EnvironmentVariableCredentialsProvider()) bucket = oss2.Bucket(auth, 'oss-cn-hongkong.aliyuncs.com', 'xiao-ling-tong') with open(yellow_video_path, "rb") as f: n = f"{uuid.uuid1()}.{yellow_video_path.rsplit('.',1)[1]}" bucket.put_object(n, f.read()) return "https://xiao-ling-tong.oss-cn-hongkong.aliyuncs.com/"+n[/ol]复制代码 [ol]# 测试文件 https://xiao-ling-tong.oss-cn-hongkong.aliyuncs.com/527044e1-4fa0-11ee-b6d2-10c37b4cd1ba.mp4[/ol]复制代码