def check_generation(generation_id): response = requests.get( f"https://platform.runblob.io/v1/sora/generations/{generation_id}/", headers={"Authorization": f"Bearer {token}"} ) data = response.json() if data["status"] == "failed": error = data["error_message"] # Handle specific errors if "photorealistic people" in error: print("Try with a different image without people") elif "policy" in error: print("Modify your prompt to comply with policies") else: print(f"Generation failed: {error}") return None return data
Always implement proper error handling in your application to provide good user experience and handle edge cases gracefully.