upload返回结果

This commit is contained in:
Jerry Yan 2025-03-11 16:15:51 +08:00
parent 744fe28421
commit c62f1ab976

View File

@ -232,7 +232,9 @@ def upload_task_file(task_info, ffmpeg_task):
upload_span.set_attribute("http.method", "PUT") upload_span.set_attribute("http.method", "PUT")
upload_span.set_attribute("http.url", url) upload_span.set_attribute("http.url", url)
with open(ffmpeg_task.get_output_file(), 'rb') as f: with open(ffmpeg_task.get_output_file(), 'rb') as f:
requests.put(url, data=f, headers={"Content-Type": "video/mp4"}) response = requests.put(url, data=f, headers={"Content-Type": "video/mp4"})
upload_span.set_attribute("http.status_code", response.status_code)
upload_span.set_attribute("http.response", response.text)
except requests.RequestException as e: except requests.RequestException as e:
span.set_attribute("api.error", str(e)) span.set_attribute("api.error", str(e))
logger.error("上传失败!", e) logger.error("上传失败!", e)