利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.
Python ai-video-generatorcontent-creationffmpeginstagram-reelsllmpythonshort-videosubtitlestext-to-speechtiktokvideo-automationvideo-workflowworkflow-automationyoutube-shorts
fix(upload-post): retain the tracking handle after redirect responses
Rudy Celekli3eb6bc58287d
diff --git a/app/services/upload_post.py b/app/services/upload_post.pyindex 0df9fffe..2fad4578 100644--- a/app/services/upload_post.py+++ b/app/services/upload_post.py@@ -266,10 +266,9 @@ class UploadPostService:"Upload-Post upload returned an unexpected redirect: "f"status={response.status_code}")- return {- "success": False,- "error": "Upload-Post upload returned an unexpected redirect",- }+ return unconfirmed_response(+ "Upload-Post upload returned an unexpected redirect"+ )response.raise_for_status()try:diff --git a/test/services/test_upload_redirect_handle_native.py b/test/services/test_upload_redirect_handle_native.pynew file mode 100644index 00000000..b6bffae8--- /dev/null+++ b/test/services/test_upload_redirect_handle_native.py@@ -0,0 +1,43 @@+import http.server+import threading+from app.services.upload_post import UploadPostService+++def test_real_redirect_keeps_sent_upload_handle_without_replay(tmp_path):+ calls = []++ class Handler(http.server.BaseHTTPRequestHandler):+ def do_POST(self):+ body = self.rfile.read(int(self.headers["Content-Length"]))+ calls.append(body)+ self.send_response(307)+ self.send_header("Location", "/another-upload")+ self.send_header("Content-Length", "0")+ self.end_headers()++ def log_message(self, *args):+ pass++ server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), Handler)+ worker = threading.Thread(target=server.serve_forever, daemon=True)+ worker.start()+ video = tmp_path / "clip.mp4"+ video.write_bytes(b"synthetic-upload-fixture")+ service = UploadPostService(+ {+ "upload_post_enabled": True,+ "upload_post_api_key": "synthetic-key",+ "upload_post_username": "fixture",+ }+ )+ service.API_BASE = "http://127.0.0.1:" + str(server.server_address[1])+ try:+ result = service.upload_video(str(video), "fixture", platforms=["tiktok"])+ finally:+ server.shutdown()+ server.server_close()+ worker.join(2)+ assert not result["success"]+ assert len(calls) == 1+ assert result["request_id"].encode() in calls[0]+ assert "unconfirmed" in result["error"]