import requests
url = "https://www.chenyu.cn/api/open/v2/instance/save_image"
headers = {
"Authorization": "Bearer your_api_key",
"Content-Type": "application/json"
}
data = {
"instance_uuid": "inst_12345678-1234-1234-1234-123456789012",
"image_name": "my-custom-image",
"remark": "包含深度学习环境的自定义镜像"
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
if result['code'] == 0:
print("镜像保存成功")
else:
print(f"保存失败: {result['msg']}")