()
| 8 | |
| 9 | |
| 10 | def preupload(): |
| 11 | url = f"{base_url}/api/v2/parse/preupload" |
| 12 | headers = {"Authorization": f"Bearer {secret}"} |
| 13 | res = rq.post(url, headers=headers) |
| 14 | res.raise_for_status() # 检查HTTP请求是否成功 |
| 15 | data = res.json() |
| 16 | if data.get("code") == "success": |
| 17 | return data["data"] |
| 18 | raise Exception(f"get preupload url failed: {data}") |
| 19 | |
| 20 | |
| 21 | def put_file(path: str, url: str): |