import os
import requests
from http import HTTPStatus
'''
API名称:文档删除
API路径:https://dashscope.aliyuncs.com/api/v2/apps/zhiwen-file/delete_file
环境要求:Python >= 3.7
'''
url = "https://dashscope.aliyuncs.com/api/v2/apps/zhiwen-file/delete_file"
request_headers = {
"Authorization": os.environ.get("DASHSCOPE_API_KEY"), # 如果您没有配置环境变量,请在此处替换您的API-KEY
"Content-Type": "application/json"
}
response = requests.post(url,
json={
"fileId": "file_zhiwen_5f6e46d308a145b182c4bf1b788cea07_10035945"
},
headers=request_headers)
if response.status_code == HTTPStatus.OK:
print(response.json())
else:
print(f'response={response.json()}')
print(f'code={response.status_code}')