Function
request_t2i_sync
(
base_url: str,
payload: dict,
timeout_seconds: int,
poll_interval_seconds: float,
)
Source from the content-addressed store, hash-verified
| 21 | |
| 22 | def request_t2i_sync( |
| 23 | base_url: str, |
| 24 | payload: dict, |
| 25 | timeout_seconds: int, |
| 26 | poll_interval_seconds: float, |
| 27 | ) -> bytes: |
| 28 | endpoint = f"{base_url.rstrip('/')}/v1/tasks/sync?timeout_seconds={timeout_seconds}&poll_interval_seconds={poll_interval_seconds}" |
| 29 | response = requests.post(endpoint, json=payload, timeout=timeout_seconds + 30) |
| 30 | if response.status_code != 200: |
| 31 | raise RuntimeError(f"Sync t2i failed ({response.status_code}): {response.text}") |
| 32 | return response.content |
| 33 | |
| 34 | |
| 35 | def save_result(content: bytes, output_path: str) -> Path: |
| 36 | output = Path(output_path) |
Tested by
no test coverage detected