crowdin-api-client


Namecrowdin-api-client JSON
Version 1.15.0 PyPI version JSON
download
home_pagehttps://github.com/crowdin/crowdin-api-client-python
SummaryPython client library for Crowdin API v2
upload_time2024-03-07 10:07:42
maintainer
docs_urlNone
authorСrowdin
requires_python>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <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)&nbsp;[![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/) &nbsp;|&nbsp;
[**`Crowdin API`**](https://developer.crowdin.com/api/v2/) &nbsp;|&nbsp;
[**`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())
```

## 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": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "",
    "author": "\u0421rowdin",
    "author_email": "support@crowdin.com",
    "download_url": "https://files.pythonhosted.org/packages/fa/5f/76d8a7e828cfcb6339854fe2c912016e1eb5ecb3c5b2c371c1aa114d5053/crowdin-api-client-1.15.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)&nbsp;[![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/) &nbsp;|&nbsp;\n[**`Crowdin API`**](https://developer.crowdin.com/api/v2/) &nbsp;|&nbsp;\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## 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.15.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": "31add788890370129f7c633f5419db44aff2ead0c73d5d7c658e576f0d440cac",
                "md5": "9ef9030cdbf2465e551682ab3ed33641",
                "sha256": "b9c1826bbd5a26df7b71a2d32c188b6d1d683b1ea273a4c0cf013c4658d2d046"
            },
            "downloads": -1,
            "filename": "crowdin_api_client-1.15.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9ef9030cdbf2465e551682ab3ed33641",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 92207,
            "upload_time": "2024-03-07T10:07:40",
            "upload_time_iso_8601": "2024-03-07T10:07:40.828558Z",
            "url": "https://files.pythonhosted.org/packages/31/ad/d788890370129f7c633f5419db44aff2ead0c73d5d7c658e576f0d440cac/crowdin_api_client-1.15.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa5f76d8a7e828cfcb6339854fe2c912016e1eb5ecb3c5b2c371c1aa114d5053",
                "md5": "1161f668702cfeed67c570fc41dc65a7",
                "sha256": "4bfcacc4874a1ac631cb2bf59b89bcb667ad8c7c01a3b96c2e6055f708957461"
            },
            "downloads": -1,
            "filename": "crowdin-api-client-1.15.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1161f668702cfeed67c570fc41dc65a7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 57166,
            "upload_time": "2024-03-07T10:07:42",
            "upload_time_iso_8601": "2024-03-07T10:07:42.903650Z",
            "url": "https://files.pythonhosted.org/packages/fa/5f/76d8a7e828cfcb6339854fe2c912016e1eb5ecb3c5b2c371c1aa114d5053/crowdin-api-client-1.15.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-07 10:07:42",
    "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"
}
        
Elapsed time: 0.24173s