Python SDK for the Zamzar file conversion API
pip install pyzamzar
Create an account, log in and obtain your API key here
from zamzar import ZamzarClient
client = ZamzarClient('YOUR_API_KEY')
Example:
job_info = client.start_conversion_job('README.md', 'pdf')
job_id = job_info['id']
Example:
while True:
job_status = client.get_job_status(job_id)
if job_status['status'] == 'successful':
break
elif job_status['status'] == 'failed':
print("Conversion failed.")
return
else:
print("Conversion in progress. Please wait...")
Example:
file_id = job_status['target_files'][0]['id']
client.download_converted_file(file_id, 'readme.pdf')
print("File downloaded successfully as 'readme.pdf'.")