2024-11-27 11:22:19 +08:00

18 lines
445 B
Python

import requests
def upload_to_oss_use_signed_url(url, file_path):
"""
使用签名URL上传文件到OSS
:param str url: 签名URL
:param str file_path: 文件路径
:return bool: 是否成功
"""
with open(file_path, 'rb') as f:
try:
response = requests.put(url, data=f)
return response.status_code == 200
except Exception as e:
print(e)
return False