# Python file converter library for Zamzar
[![@zamzar on Twitter](https://img.shields.io/badge/twitter-zamzar-blue)](https://twitter.com/zamzar)
[![pypi version](https://img.shields.io/pypi/v/zamzar-sdk.svg)](https://pypi.python.org/pypi/zamzar-sdk)
[![GitHub License](https://img.shields.io/github/license/zamzar/zamzar-python)](https://github.com/zamzar/zamzar-python/blob/main/LICENSE)
Easy to use Python file conversion API with support for 1,100+ file conversions - convert documents, audio, images,
video, eBooks and more. Use `zamzar-python` to convert files between different formats as part of your Python
application with the [Zamzar file conversion API](https://developers.zamzar.com). Common use cases include:
- Convert Microsoft Word (DOCX, DOC) to PDF
- Convert Powerpoint (PPT, PPTX) to JPG
- Extract text from PDF files
- Archive email (MSG files) to PDF
This is the official Python SDK for the [Zamzar API](https://developers.zamzar.com).
Jump to:
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Resources](#resources)
## Requirements
- Before you begin, signup for a Zamzar API Account or retrieve your existing API Key from
the [Zamzar Developers Homepage](https://developers.zamzar.com/user)
- Python 3.7 and later
## Installation
You can install the Zamzar Python SDK using pip:
```bash
pip install --upgrade zamzar-sdk
```
## Usage
### Getting Started
Please follow the [installation](#installation) instructions and execute the following Python code:
```python
from zamzar_sdk import ZamzarClient
zamzar = ZamzarClient("YOUR_API_KEY_GOES_HERE")
zamzar.convert("/tmp/example.docx", "pdf").store("/tmp/").delete_all_files()
```
See the [examples](https://github.com/zamzar/zamzar-python/tree/main/examples) to learn more
about how to use the Zamzar Python SDK.
### Using the sandbox environment
Whilst developing your application, you can use the lZamzar sandbox environment to test your code without consuming
production credits:
```python
from zamzar_sdk import ZamzarClient, Environment
zamzar = ZamzarClient("YOUR_API_KEY_GOES_HERE", environment=Environment.SANDBOX)
```
The Zamzar Python SDK uses the production environment by default, but you can also specify it explicitly:
```python
from zamzar_sdk import ZamzarClient, Environment
zamzar = ZamzarClient("YOUR_API_KEY_GOES_HERE", environment=Environment.PRODUCTION)
```
### Logging
By default, the Zamzar Python SDK does not log HTTP requests and responses. To enable logging, configure a
[logging.Logger](https://docs.python.org/3/library/logging.html#logging.Logger) for `urllib3`:
```python
import logging
from zamzar_sdk import ZamzarClient
# Configure logging as needed. Here we configure a simple console logger
console_handler = logging.StreamHandler()
console_handler.setLevel(logging.DEBUG) # Set the logging level for the console handler
console_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
console_handler.setFormatter(console_formatter)
root_logger = logging.getLogger()
root_logger.addHandler(console_handler)
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
# Enable logging for urllib3 to see HTTP requests
urllib3_logger = logging.getLogger('urllib3')
urllib3_logger.setLevel(logging.DEBUG)
# Make a request to the Zamzar API
zamzar = ZamzarClient("YOUR_API_KEY_GOES_HERE")
zamzar.account.get()
```
### Configuring timeouts and retries
The Zamzar Python SDK will automatically:
* time out long-running requests
* retry requests that fail or time out
The default settings are defined
in [ZamzarClient](https://github.com/zamzar/zamzar-python/blob/main/zamzar/facade/zamzar_client.py).
To override these defaults, configure your
own [urllib3.Retry](https://urllib3.readthedocs.io/en/stable/reference/urllib3.util.html#urllib3.util.Retry) and pass it
to the `ZamzarClient` constructor:
```python
import urllib3
from zamzar_sdk import ZamzarClient
# Configure a custom retry policy
custom_policy = urllib3.Retry(
total=5, # Maximum number of retries
backoff_factor=1, # Exponential backoff factor
backoff_max=60, # Maximum backoff time
status_forcelist=[429, 502, 503, 504], # HTTP status codes to retry
allowed_methods=None # retry all request methods
)
# Make a request to the Zamzar API
zamzar = ZamzarClient("YOUR_API_KEY_GOES_HERE", retries=custom_policy)
```
## Resources
[Code Samples](https://github.com/zamzar/zamzar-python/tree/main/examples) - Copy/Paste from
examples which demonstrate all key areas of functionality.
[Developer Docs](https://developers.zamzar.com/docs) - For more information about API operations, parameters, and
responses. Use this if you need additional context on all areas of functionality.
Raw data
{
"_id": null,
"home_page": "https://github.com/zamzar/zamzar-python",
"name": "zamzar-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "Zamzar, Zamzar API, File Conversion, File Utilities, Convert",
"author": "Zamzar",
"author_email": "api-sdks@zamzar.com",
"download_url": "https://files.pythonhosted.org/packages/f1/ef/6030b9b71194a248e6fb0e7ee90071be373c65f2d5f32ad22fc33ee98d2e/zamzar_sdk-1.0.0.tar.gz",
"platform": null,
"description": "# Python file converter library for Zamzar\n\n[![@zamzar on Twitter](https://img.shields.io/badge/twitter-zamzar-blue)](https://twitter.com/zamzar)\n[![pypi version](https://img.shields.io/pypi/v/zamzar-sdk.svg)](https://pypi.python.org/pypi/zamzar-sdk)\n[![GitHub License](https://img.shields.io/github/license/zamzar/zamzar-python)](https://github.com/zamzar/zamzar-python/blob/main/LICENSE)\n\nEasy to use Python file conversion API with support for 1,100+ file conversions - convert documents, audio, images,\nvideo, eBooks and more. Use `zamzar-python` to convert files between different formats as part of your Python\napplication with the [Zamzar file conversion API](https://developers.zamzar.com). Common use cases include:\n\n- Convert Microsoft Word (DOCX, DOC) to PDF\n- Convert Powerpoint (PPT, PPTX) to JPG\n- Extract text from PDF files\n- Archive email (MSG files) to PDF\n\nThis is the official Python SDK for the [Zamzar API](https://developers.zamzar.com).\n\nJump to:\n\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Resources](#resources)\n\n## Requirements\n\n- Before you begin, signup for a Zamzar API Account or retrieve your existing API Key from\n the [Zamzar Developers Homepage](https://developers.zamzar.com/user)\n- Python 3.7 and later\n\n## Installation\n\nYou can install the Zamzar Python SDK using pip:\n\n```bash\npip install --upgrade zamzar-sdk\n```\n\n## Usage\n\n### Getting Started\n\nPlease follow the [installation](#installation) instructions and execute the following Python code:\n\n```python\nfrom zamzar_sdk import ZamzarClient\n\nzamzar = ZamzarClient(\"YOUR_API_KEY_GOES_HERE\")\n\nzamzar.convert(\"/tmp/example.docx\", \"pdf\").store(\"/tmp/\").delete_all_files()\n```\n\nSee the [examples](https://github.com/zamzar/zamzar-python/tree/main/examples) to learn more\nabout how to use the Zamzar Python SDK.\n\n### Using the sandbox environment\n\nWhilst developing your application, you can use the lZamzar sandbox environment to test your code without consuming\nproduction credits:\n\n```python\nfrom zamzar_sdk import ZamzarClient, Environment\n\nzamzar = ZamzarClient(\"YOUR_API_KEY_GOES_HERE\", environment=Environment.SANDBOX)\n```\n\nThe Zamzar Python SDK uses the production environment by default, but you can also specify it explicitly:\n\n```python\nfrom zamzar_sdk import ZamzarClient, Environment\n\nzamzar = ZamzarClient(\"YOUR_API_KEY_GOES_HERE\", environment=Environment.PRODUCTION)\n```\n\n### Logging\n\nBy default, the Zamzar Python SDK does not log HTTP requests and responses. To enable logging, configure a\n[logging.Logger](https://docs.python.org/3/library/logging.html#logging.Logger) for `urllib3`:\n\n```python\nimport logging\n\nfrom zamzar_sdk import ZamzarClient\n\n# Configure logging as needed. Here we configure a simple console logger\nconsole_handler = logging.StreamHandler()\nconsole_handler.setLevel(logging.DEBUG) # Set the logging level for the console handler\nconsole_formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\nconsole_handler.setFormatter(console_formatter)\nroot_logger = logging.getLogger()\nroot_logger.addHandler(console_handler)\nlogging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n\n# Enable logging for urllib3 to see HTTP requests\nurllib3_logger = logging.getLogger('urllib3')\nurllib3_logger.setLevel(logging.DEBUG)\n\n# Make a request to the Zamzar API\nzamzar = ZamzarClient(\"YOUR_API_KEY_GOES_HERE\")\nzamzar.account.get()\n```\n\n### Configuring timeouts and retries\n\nThe Zamzar Python SDK will automatically:\n\n* time out long-running requests\n* retry requests that fail or time out\n\nThe default settings are defined\nin [ZamzarClient](https://github.com/zamzar/zamzar-python/blob/main/zamzar/facade/zamzar_client.py).\n\nTo override these defaults, configure your\nown [urllib3.Retry](https://urllib3.readthedocs.io/en/stable/reference/urllib3.util.html#urllib3.util.Retry) and pass it\nto the `ZamzarClient` constructor:\n\n```python\nimport urllib3\n\nfrom zamzar_sdk import ZamzarClient\n\n# Configure a custom retry policy\ncustom_policy = urllib3.Retry(\n total=5, # Maximum number of retries\n backoff_factor=1, # Exponential backoff factor\n backoff_max=60, # Maximum backoff time\n status_forcelist=[429, 502, 503, 504], # HTTP status codes to retry\n allowed_methods=None # retry all request methods\n)\n\n# Make a request to the Zamzar API\nzamzar = ZamzarClient(\"YOUR_API_KEY_GOES_HERE\", retries=custom_policy)\n```\n\n## Resources\n\n[Code Samples](https://github.com/zamzar/zamzar-python/tree/main/examples) - Copy/Paste from\nexamples which demonstrate all key areas of functionality.\n\n[Developer Docs](https://developers.zamzar.com/docs) - For more information about API operations, parameters, and\nresponses. Use this if you need additional context on all areas of functionality.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Official Python client for the Zamzar API",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/zamzar/zamzar-python"
},
"split_keywords": [
"zamzar",
" zamzar api",
" file conversion",
" file utilities",
" convert"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "de42a8906478da12a3a628f15000b175e012408898d387eb96c8d379aa72a1e8",
"md5": "3713eb102dbd0c589c6fb4feb9b57402",
"sha256": "78accc6f34ed878527913fba2add493b7c0c25c3ef3af9e2f4d6ff7b338bad12"
},
"downloads": -1,
"filename": "zamzar_sdk-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3713eb102dbd0c589c6fb4feb9b57402",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 84857,
"upload_time": "2024-12-03T15:40:28",
"upload_time_iso_8601": "2024-12-03T15:40:28.725901Z",
"url": "https://files.pythonhosted.org/packages/de/42/a8906478da12a3a628f15000b175e012408898d387eb96c8d379aa72a1e8/zamzar_sdk-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f1ef6030b9b71194a248e6fb0e7ee90071be373c65f2d5f32ad22fc33ee98d2e",
"md5": "78abcc2ea0b95a2597ec80b124048cd7",
"sha256": "e589c7a378d7712286d7d0a2722d035ad83c301e12f95436c617eb89882139a1"
},
"downloads": -1,
"filename": "zamzar_sdk-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "78abcc2ea0b95a2597ec80b124048cd7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 49818,
"upload_time": "2024-12-03T15:40:29",
"upload_time_iso_8601": "2024-12-03T15:40:29.708179Z",
"url": "https://files.pythonhosted.org/packages/f1/ef/6030b9b71194a248e6fb0e7ee90071be373c65f2d5f32ad22fc33ee98d2e/zamzar_sdk-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-03 15:40:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zamzar",
"github_project": "zamzar-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "pydantic",
"specs": [
[
">=",
"2"
]
]
},
{
"name": "python_dateutil",
"specs": [
[
">=",
"2.5.3"
]
]
},
{
"name": "setuptools",
"specs": [
[
">=",
"21.0.0"
]
]
},
{
"name": "typing-extensions",
"specs": [
[
">=",
"4.7.1"
]
]
},
{
"name": "urllib3",
"specs": [
[
">=",
"2.0.2"
]
]
}
],
"tox": true,
"lcname": "zamzar-sdk"
}