<p align="center">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cWhite.png">
<source media="(prefers-color-scheme: light)" srcset="https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cDark.png">
<img width="150" height="150" src="https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cDark.png">
</picture>
</p>
# Crowdin Python client [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fcrowdin%2Fcrowdin-api-client-python&text=The%20Crowdin%20Python%20client%20is%20a%20lightweight%20interface%20to%20the%20Crowdin%20API) [![GitHub Repo stars](https://img.shields.io/github/stars/crowdin/crowdin-api-client-python?style=social&cacheSeconds=1800)](https://github.com/crowdin/crowdin-api-client-python/stargazers)
The Crowdin Python client is a lightweight interface to the Crowdin API. It provides common services for making API requests.
Crowdin API is a full-featured RESTful API that helps you to integrate localization into your development process. The endpoints that we use allow you to easily make calls to retrieve information and to execute actions needed.
<div align="center">
[**`API Client Docs`**](https://crowdin.github.io/crowdin-api-client-python/) |
[**`Crowdin API`**](https://developer.crowdin.com/api/v2/) |
[**`Crowdin Enterprise API`**](https://developer.crowdin.com/enterprise/api/v2/)
[![PyPI](https://img.shields.io/pypi/v/crowdin-api-client?cacheSeconds=3600)](https://pypi.org/project/crowdin-api-client/)
[![Downloads](https://pepy.tech/badge/crowdin-api-client)](https://pepy.tech/project/crowdin-api-client)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/crowdin-api-client?cacheSeconds=3600)](https://pypi.org/project/crowdin-api-client/)
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/crowdin/crowdin-api-client-python/python-package.yml?branch=main&logo=github)
[![codecov](https://codecov.io/gh/crowdin/crowdin-api-client-python/branch/main/graph/badge.svg?token=sOUWIcNjWO)](https://codecov.io/gh/crowdin/crowdin-api-client-python)
[![GitHub issues](https://img.shields.io/github/issues/crowdin/crowdin-api-client-python?cacheSeconds=3600)](https://github.com/crowdin/crowdin-api-client-python/issues)
[![License](https://img.shields.io/github/license/crowdin/crowdin-api-client-python?cacheSeconds=3600)](https://github.com/crowdin/crowdin-api-client-python/blob/master/LICENSE)
</div>
## Installation
```console
pip install crowdin-api-client
```
## Quick Start
### Create and list projects
```python
from crowdin_api import CrowdinClient
class FirstCrowdinClient(CrowdinClient):
TOKEN = "__token__"
PROJECT_ID = 1 # Optional, set project id for all API's
ORGANIZATION = "organizationName" # Optional, for Crowdin Enterprise only
TIMEOUT = 60 # Optional, sets http request timeout.
RETRY_DELAY = 0.1 # Optional, sets the delay between failed requests
MAX_RETRIES = 5 # Optional, sets the number of retries
HEADERS = {"Some-Header": ""} # Optional, sets additional http request headers
PAGE_SIZE = 25 # Optional, sets default page size
EXTENDED_REQUEST_PARAMS = {"some-parameters": ""} # Optional, sets additional parameters for request
client = FirstCrowdinClient()
# Create Project
project_response = client.projects.add_project(name="New project", sourceLanguageId="en")
# Get list of Projects
projects = client.projects.list_projects()
# Get list of Projects with offset and limit
projects = client.projects.list_projects(offset=10, limit=20)
# Get list of Projects by page
projects = client.projects.list_projects(page=2) # offset=25, limit=25
```
Alternatively, you can create an instance of the CrowdinClient class with params like this:
```python
from crowdin_api import CrowdinClient
# use the lower-case version of any of the constants above,
# at least provide token
client = CrowdinClient(token='__token__')
# ... continue as above
```
### Add a file
```python
from crowdin_api import CrowdinClient
client = CrowdinClient(token='__token__')
file_name = '__path_to_the_file__'
storage = client.storages.add_storage(open(file_name, 'rb'))
my_file = client.source_files.add_file(__project_id__, storage['data']['id'], file_name)
print(my_file)
```
### Fetch all records
It is possible to fetch all records from paginatable methods (where we have limit and offset in arguments).
```python
from crowdin_api import CrowdinClient
client = CrowdinClient(token='__token__')
# get all projects
print(client.projects.with_fetch_all().list_projects())
# get projects but not more than 1000
print(client.projects.with_fetch_all(1000).list_projects())
```
### Extended request parameters
The `EXTENDED_REQUEST_PARAMS` parameter allows you to set additional parameters for requests. For example, you can configure proxies or certificates.
The Client uses the [requests](https://pypi.org/project/requests/) library to make HTTP requests. You can pass any parameters that `requests` supports:
```python
def request(
self,
method,
url,
params=None,
data=None,
headers=None,
cookies=None,
files=None,
auth=None,
timeout=None,
allow_redirects=True,
proxies=None,
hooks=None,
stream=None,
verify=None,
cert=None,
json=None,
):
```
For example, you can set a [proxy](https://requests.readthedocs.io/en/latest/api/#requests.Session.proxies):
```python
from crowdin_api import CrowdinClient
http_proxy = "http://10.10.1.10:3128"
https_proxy = "https://10.10.1.11:1080"
ftp_proxy = "ftp://10.10.1.10:3128"
proxies = {
"http": http_proxy,
"https": https_proxy,
"ftp": ftp_proxy
}
class FirstCrowdinClient(CrowdinClient):
EXTENDED_REQUEST_PARAMS = {"proxies": proxies}
```
## Seeking Assistance
If you find any problems or would like to suggest a feature, please read the [How can I contribute](https://github.com/crowdin/crowdin-api-client-python/blob/main/CONTRIBUTING.md#how-can-i-contribute) section in our contributing guidelines.
## Contributing
If you would like to contribute please read the [Contributing](https://github.com/crowdin/crowdin-api-client-python/blob/main/CONTRIBUTING.md) guidelines.
## License
<pre>
The Crowdin Python client is licensed under the MIT License.
See the LICENSE file distributed with this work for additional
information regarding copyright ownership.
Except as contained in the LICENSE file, the name(s) of the above copyright
holders shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written authorization.
</pre>
Raw data
{
"_id": null,
"home_page": "https://github.com/crowdin/crowdin-api-client-python",
"name": "crowdin-api-client",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": null,
"author": "\u0421rowdin",
"author_email": "support@crowdin.com",
"download_url": "https://files.pythonhosted.org/packages/32/0b/c97afa240d691cd54ba5c15f3f7e29c8948400ccdaf08f8c6e17debae3a8/crowdin_api_client-1.18.0.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <picture>\n <source media=\"(prefers-color-scheme: dark)\" srcset=\"https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cWhite.png\">\n <source media=\"(prefers-color-scheme: light)\" srcset=\"https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cDark.png\">\n <img width=\"150\" height=\"150\" src=\"https://support.crowdin.com/assets/logos/symbol/png/crowdin-symbol-cDark.png\">\n </picture>\n</p>\n\n# Crowdin Python client [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fcrowdin%2Fcrowdin-api-client-python&text=The%20Crowdin%20Python%20client%20is%20a%20lightweight%20interface%20to%20the%20Crowdin%20API) [![GitHub Repo stars](https://img.shields.io/github/stars/crowdin/crowdin-api-client-python?style=social&cacheSeconds=1800)](https://github.com/crowdin/crowdin-api-client-python/stargazers)\n\nThe Crowdin Python client is a lightweight interface to the Crowdin API. It provides common services for making API requests.\n\nCrowdin API is a full-featured RESTful API that helps you to integrate localization into your development process. The endpoints that we use allow you to easily make calls to retrieve information and to execute actions needed.\n\n<div align=\"center\">\n\n[**`API Client Docs`**](https://crowdin.github.io/crowdin-api-client-python/) | \n[**`Crowdin API`**](https://developer.crowdin.com/api/v2/) | \n[**`Crowdin Enterprise API`**](https://developer.crowdin.com/enterprise/api/v2/)\n\n[![PyPI](https://img.shields.io/pypi/v/crowdin-api-client?cacheSeconds=3600)](https://pypi.org/project/crowdin-api-client/)\n[![Downloads](https://pepy.tech/badge/crowdin-api-client)](https://pepy.tech/project/crowdin-api-client)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/crowdin-api-client?cacheSeconds=3600)](https://pypi.org/project/crowdin-api-client/)\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/crowdin/crowdin-api-client-python/python-package.yml?branch=main&logo=github)\n[![codecov](https://codecov.io/gh/crowdin/crowdin-api-client-python/branch/main/graph/badge.svg?token=sOUWIcNjWO)](https://codecov.io/gh/crowdin/crowdin-api-client-python)\n[![GitHub issues](https://img.shields.io/github/issues/crowdin/crowdin-api-client-python?cacheSeconds=3600)](https://github.com/crowdin/crowdin-api-client-python/issues)\n[![License](https://img.shields.io/github/license/crowdin/crowdin-api-client-python?cacheSeconds=3600)](https://github.com/crowdin/crowdin-api-client-python/blob/master/LICENSE)\n\n</div>\n\n## Installation\n\n```console\npip install crowdin-api-client\n```\n\n## Quick Start\n\n### Create and list projects\n\n```python\nfrom crowdin_api import CrowdinClient\n\nclass FirstCrowdinClient(CrowdinClient):\n TOKEN = \"__token__\"\n PROJECT_ID = 1 # Optional, set project id for all API's\n ORGANIZATION = \"organizationName\" # Optional, for Crowdin Enterprise only\n TIMEOUT = 60 # Optional, sets http request timeout.\n RETRY_DELAY = 0.1 # Optional, sets the delay between failed requests \n MAX_RETRIES = 5 # Optional, sets the number of retries\n HEADERS = {\"Some-Header\": \"\"} # Optional, sets additional http request headers\n PAGE_SIZE = 25 # Optional, sets default page size\n EXTENDED_REQUEST_PARAMS = {\"some-parameters\": \"\"} # Optional, sets additional parameters for request\n\nclient = FirstCrowdinClient()\n\n# Create Project\nproject_response = client.projects.add_project(name=\"New project\", sourceLanguageId=\"en\")\n\n# Get list of Projects\nprojects = client.projects.list_projects()\n\n# Get list of Projects with offset and limit\nprojects = client.projects.list_projects(offset=10, limit=20)\n\n# Get list of Projects by page\nprojects = client.projects.list_projects(page=2) # offset=25, limit=25\n```\n\nAlternatively, you can create an instance of the CrowdinClient class with params like this:\n\n```python\nfrom crowdin_api import CrowdinClient\n\n# use the lower-case version of any of the constants above,\n# at least provide token\nclient = CrowdinClient(token='__token__')\n\n# ... continue as above\n\n```\n\n### Add a file\n\n```python\nfrom crowdin_api import CrowdinClient\n\nclient = CrowdinClient(token='__token__')\n\nfile_name = '__path_to_the_file__'\n\nstorage = client.storages.add_storage(open(file_name, 'rb'))\n\nmy_file = client.source_files.add_file(__project_id__, storage['data']['id'], file_name)\n\nprint(my_file)\n```\n\n### Fetch all records\n\nIt is possible to fetch all records from paginatable methods (where we have limit and offset in arguments).\n\n```python\nfrom crowdin_api import CrowdinClient\n\nclient = CrowdinClient(token='__token__')\n\n# get all projects\nprint(client.projects.with_fetch_all().list_projects())\n\n# get projects but not more than 1000\nprint(client.projects.with_fetch_all(1000).list_projects())\n```\n\n### Extended request parameters\n\nThe `EXTENDED_REQUEST_PARAMS` parameter allows you to set additional parameters for requests. For example, you can configure proxies or certificates.\n\nThe Client uses the [requests](https://pypi.org/project/requests/) library to make HTTP requests. You can pass any parameters that `requests` supports:\n\n```python\ndef request(\n self,\n method,\n url,\n params=None,\n data=None,\n headers=None,\n cookies=None,\n files=None,\n auth=None,\n timeout=None,\n allow_redirects=True,\n proxies=None,\n hooks=None,\n stream=None,\n verify=None,\n cert=None,\n json=None,\n):\n```\n\nFor example, you can set a [proxy](https://requests.readthedocs.io/en/latest/api/#requests.Session.proxies):\n\n```python\nfrom crowdin_api import CrowdinClient\n\nhttp_proxy = \"http://10.10.1.10:3128\"\nhttps_proxy = \"https://10.10.1.11:1080\"\nftp_proxy = \"ftp://10.10.1.10:3128\"\n\nproxies = {\n \"http\": http_proxy,\n \"https\": https_proxy,\n \"ftp\": ftp_proxy\n}\n\nclass FirstCrowdinClient(CrowdinClient):\n EXTENDED_REQUEST_PARAMS = {\"proxies\": proxies}\n```\n\n## Seeking Assistance\n\nIf you find any problems or would like to suggest a feature, please read the [How can I contribute](https://github.com/crowdin/crowdin-api-client-python/blob/main/CONTRIBUTING.md#how-can-i-contribute) section in our contributing guidelines.\n\n## Contributing\n\nIf you would like to contribute please read the [Contributing](https://github.com/crowdin/crowdin-api-client-python/blob/main/CONTRIBUTING.md) guidelines.\n\n## License\n\n<pre>\nThe Crowdin Python client is licensed under the MIT License.\nSee the LICENSE file distributed with this work for additional\ninformation regarding copyright ownership.\n\nExcept as contained in the LICENSE file, the name(s) of the above copyright\nholders shall not be used in advertising or otherwise to promote the sale,\nuse or other dealings in this Software without prior written authorization.\n</pre>\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python client library for Crowdin API v2",
"version": "1.18.0",
"project_urls": {
"Documentation": "https://support.crowdin.com/api/v2/",
"Homepage": "https://github.com/crowdin/crowdin-api-client-python",
"Source Code": "https://github.com/crowdin/crowdin-api-client-python"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2a980214ab9da75ff3916ece38f4f1ce28e86e4f3d1a8314656a4dea270fd25a",
"md5": "7b4170069414f425029ef1290735e052",
"sha256": "96eb9f92747d18554fb90e9efa628f4c6f7b67dc116960ece89645806a05a34a"
},
"downloads": -1,
"filename": "crowdin_api_client-1.18.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7b4170069414f425029ef1290735e052",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 97555,
"upload_time": "2024-11-01T13:26:50",
"upload_time_iso_8601": "2024-11-01T13:26:50.180849Z",
"url": "https://files.pythonhosted.org/packages/2a/98/0214ab9da75ff3916ece38f4f1ce28e86e4f3d1a8314656a4dea270fd25a/crowdin_api_client-1.18.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "320bc97afa240d691cd54ba5c15f3f7e29c8948400ccdaf08f8c6e17debae3a8",
"md5": "6e256d544774bc39f7b997c1b3205e67",
"sha256": "b388c21a4431063039259958c5dcbdbd269e5da4b06fcbd4b80db842be707704"
},
"downloads": -1,
"filename": "crowdin_api_client-1.18.0.tar.gz",
"has_sig": false,
"md5_digest": "6e256d544774bc39f7b997c1b3205e67",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 61311,
"upload_time": "2024-11-01T13:26:52",
"upload_time_iso_8601": "2024-11-01T13:26:52.094236Z",
"url": "https://files.pythonhosted.org/packages/32/0b/c97afa240d691cd54ba5c15f3f7e29c8948400ccdaf08f8c6e17debae3a8/crowdin_api_client-1.18.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-01 13:26:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "crowdin",
"github_project": "crowdin-api-client-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "crowdin-api-client"
}