The `cloudconvert` library is the official Python SDK for the CloudConvert API v2, providing a convenient wrapper to convert, optimize, and manipulate various file formats programmatically. As of version 2.1.0, it supports features like Signed URLs and improved synchronous API endpoints for job and task waiting. The library is under active development, with major releases often coinciding with updates to the underlying CloudConvert API.
pip install cloudconvertVerified import paths — ran on the pinned version, not inferred.
This quickstart example demonstrates how to configure the CloudConvert SDK, create a job to convert a file from a URL to PDF, wait for the conversion to complete, and then download the resulting PDF. It uses an environment variable for the API key for secure handling.
Migrate your code to use CloudConvert API v2 logic and endpoints. Refer to the official API v2 documentation and SDK examples.
When waiting for a specific task within a job, ensure you extract the `id` of the *task* you want to wait for. For example, `task_id = job['tasks'][0]['id']` or iterate through `job['tasks']` to find the relevant task ID. To wait for a full job, use `cloudconvert.Job.wait(id=job['id'])`.
Always construct your `payload` with `{'tasks': {...}}` where `...` defines your import, convert, and export tasks. Consult the CloudConvert API v2 documentation's Job Builder for correct payload structures.If encountering `INPUT_TASK_FAILED` errors for files with spaces, try renaming files to use hyphens or underscores instead of spaces as a workaround, or ensure that file paths are properly URL-encoded if constructing URLs manually.
Ensure the `payload` argument to `cloudconvert.Job.create()` is correctly formatted, always including a top-level `'tasks'` key. If iterating a job response, ensure the job has been properly fetched and contains the 'tasks' key.
The `Task.wait()` method expects the ID of a specific task. If you have a job object, extract the relevant task's ID (e.g., `task_id = job['tasks'][0]['id']`) before passing it to `Task.wait()`. For waiting on the entire job, use `cloudconvert.Job.wait(id=job['id'])`.
Verify your API key on the CloudConvert dashboard and ensure it's correctly passed to `cloudconvert.configure(api_key='YOUR_API_KEY')` or set as the `CLOUDCONVERT_API_KEY` environment variable for `cloudconvert.default()`.
Check the specific error message for details. For V1 error codes, ensure you have fully migrated to API v2. Verify the input file path, format, and size. Increase conversion timeout if possible or simplify the conversion.
No dependency data recorded yet.