#!/usr/bin/env python3
"""生成COS预签名下载链接"""
import os
os.environ['ZY_OSS_KEY'] = 'AKIDkQuBQhoiS2OYXWebXLwMbdT7cvAScbbU'
os.environ['ZY_OSS_SECRET'] = 'nPoZKArgUJBA4nJenjSxJSQBj5FCj3A4'
from qcloud_cos import CosConfig, CosS3Client
cfg = CosConfig(Region='ap-guangzhou', SecretId=os.environ['ZY_OSS_KEY'], SecretKey=os.environ['ZY_OSS_SECRET'])
client = CosS3Client(cfg)
bkt = 'sy-finetune-corpus-1317346199'
for key in ['models/qwen25-15b-shuangyan-distill/model.safetensors',
            'models/qwen25-15b-coder-distill/model.safetensors']:
    url = client.get_presigned_url(Method='GET', Bucket=bkt, Key=key, Expired=604800)
    desc = key.split('/')[1].replace('-distill','')
    print(f'{desc}: {url}')
