新影棚的对齐程序

This commit is contained in:
dongchangxi committed 2025-01-03 15:52:58 +08:00
1 parent 7ed40f30ec
commit 6f8f34c4ac
5 files changed
+388 -2

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
import requests
#url
#循环100次
for i in range(100):
url = "https://mp.api.suwa3d.com/api/oss/putSignURL?key_name=photos/233522/photo2/"+str(i)+".jpg"
#请求url
res = requests.get(url)
#打印结果
print(res.text)
#转json
res_json = res.json()
ossUrl = res_json['data']
print(f"当前是第几个:{i}, ossUrl: {ossUrl}")
# data 是一个 oss 的上传连接, 向这个上传连接发送一个文件
# 上传文件
try:
#with open("E:/microservice/make2/data/0.jpg", 'rb') as f:
file = open('E:/microservice/make2/data/0.jpg', 'rb')
response = requests.put(ossUrl, data=file, headers={"Content-Type": "application/octet-stream"})
print(response.status_code)
if response.status_code == 200:
upload_is_ok = True
else:
print(f"上传图片异常,状态码: {response.status_code}")
except RequestException as e:
print(f"上传异常: {str(e)}")
# file = open('E:/microservice/make2/data/0.jpg', 'rb')
# res = requests.put(ossUrl, data=file)
# print(res.text)
# url = "https://mp.api.suwa3d.com/api/oss/putSignURL?key_name=objs/photos/233522/a.jpg"