Detect Language API Python Client
========
[](https://badge.fury.io/py/detectlanguage)
[](https://github.com/detectlanguage/detectlanguage-python/actions)
Detects language of given text. Returns detected language codes and scores.
Before using Detect Language API client you have to setup your personal API key.
You can get it by signing up at https://detectlanguage.com
## Installation
```
pip install detectlanguage
```
### Upgrading
When upgrading please check [changelog](CHANGELOG.md) for breaking changes.
### Configuration
```python
import detectlanguage
detectlanguage.configuration.api_key = "YOUR API KEY"
# You can use proxy if needed
# detectlanguage.configuration.proxies = {'https': 'https://user:pass@proxy:8080'}
```
## Usage
### Detect language
```python
detectlanguage.detect("Dolce far niente")
```
#### Result
```python
[{'language': 'it', 'score': 0.5074}]
```
### Detect single code
If you need just a language code you can use `detect_code`.
```python
detectlanguage.detect_code("Dolce far niente")
```
#### Result
```python
'it'
```
### Batch detection
It is possible to detect language of several texts with one request.
This method is faster than doing one request per text.
```python
detectlanguage.detect_batch(["Dolce far niente", "Hello world"])
```
#### Result
Result is array of detections in the same order as the texts were passed.
```python
[[{'language': 'it', 'score': 0.5074}], [{'language': 'en', 'score': 0.9098}]]
```
### Get your account status
```python
detectlanguage.account_status()
```
#### Result
```python
{ 'status': 'ACTIVE', 'daily_requests_limit': 5000, 'daily_bytes_limit': 1048576,
'bytes': 3151, 'plan': 'FREE', 'date': '2014-03-29', 'requests': 263,
'plan_expires': None }
```
### Get list of supported languages
```python
detectlanguage.languages()
```
#### Result
```python
[{'code': 'aa', 'name': 'Afar'}, {'code': 'ab', 'name': 'Abkhazian'}, ...]
```
## License
Detect Language API Python Client is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
Raw data
{
"_id": null,
"home_page": "https://github.com/detectlanguage/detectlanguage-python",
"name": "detectlanguage",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "language, identification, detection, api, client",
"author": "Laurynas Butkus",
"author_email": "info@detectlanguage.com",
"download_url": "https://files.pythonhosted.org/packages/d2/67/3a3b478b85a4f989062a9d2f16e26c4a2e358e60fb62a606c75b4b64e8db/detectlanguage-2.0.0.tar.gz",
"platform": null,
"description": "Detect Language API Python Client\n========\n\n[](https://badge.fury.io/py/detectlanguage)\n[](https://github.com/detectlanguage/detectlanguage-python/actions)\n\nDetects language of given text. Returns detected language codes and scores.\n\nBefore using Detect Language API client you have to setup your personal API key.\nYou can get it by signing up at https://detectlanguage.com\n\n## Installation\n\n```\npip install detectlanguage\n```\n\n### Upgrading\n\nWhen upgrading please check [changelog](CHANGELOG.md) for breaking changes.\n\n### Configuration\n\n```python\nimport detectlanguage\n\ndetectlanguage.configuration.api_key = \"YOUR API KEY\"\n\n# You can use proxy if needed\n# detectlanguage.configuration.proxies = {'https': 'https://user:pass@proxy:8080'}\n```\n\n## Usage\n\n### Detect language\n\n```python\ndetectlanguage.detect(\"Dolce far niente\")\n```\n\n#### Result\n\n```python\n[{'language': 'it', 'score': 0.5074}]\n```\n\n### Detect single code\n\nIf you need just a language code you can use `detect_code`.\n\n```python\ndetectlanguage.detect_code(\"Dolce far niente\")\n```\n\n#### Result\n\n```python\n'it'\n```\n\n### Batch detection\n\nIt is possible to detect language of several texts with one request.\nThis method is faster than doing one request per text.\n\n```python\ndetectlanguage.detect_batch([\"Dolce far niente\", \"Hello world\"])\n```\n\n#### Result\n\nResult is array of detections in the same order as the texts were passed.\n\n```python\n[[{'language': 'it', 'score': 0.5074}], [{'language': 'en', 'score': 0.9098}]]\n```\n\n### Get your account status\n\n```python\ndetectlanguage.account_status()\n```\n\n#### Result\n\n```python\n{ 'status': 'ACTIVE', 'daily_requests_limit': 5000, 'daily_bytes_limit': 1048576,\n 'bytes': 3151, 'plan': 'FREE', 'date': '2014-03-29', 'requests': 263,\n 'plan_expires': None }\n```\n\n### Get list of supported languages\n\n```python\ndetectlanguage.languages()\n```\n\n#### Result\n\n```python\n[{'code': 'aa', 'name': 'Afar'}, {'code': 'ab', 'name': 'Abkhazian'}, ...]\n```\n\n## License\n\nDetect Language API Python Client is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Language Detection API Client",
"version": "2.0.0",
"project_urls": {
"Download": "https://github.com/detectlanguage/detectlanguage-python",
"Homepage": "https://github.com/detectlanguage/detectlanguage-python"
},
"split_keywords": [
"language",
" identification",
" detection",
" api",
" client"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8bcb18fa7f4451855645a70c2d757c22eeaed8b23a3c633b150db11d85f874c8",
"md5": "0754538a442b0e6219cf4eef37012c5c",
"sha256": "24fe10946284e113d34267b8026c388df291e1d94f922d2c55b6a79fedaed68d"
},
"downloads": -1,
"filename": "detectlanguage-2.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0754538a442b0e6219cf4eef37012c5c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5399,
"upload_time": "2025-08-20T16:47:49",
"upload_time_iso_8601": "2025-08-20T16:47:49.905336Z",
"url": "https://files.pythonhosted.org/packages/8b/cb/18fa7f4451855645a70c2d757c22eeaed8b23a3c633b150db11d85f874c8/detectlanguage-2.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d2673a3b478b85a4f989062a9d2f16e26c4a2e358e60fb62a606c75b4b64e8db",
"md5": "c2975297660c880dd8bb098fe0d8cb00",
"sha256": "2746b629744b9603156df4bd528e09506be49c00edaa2ee02310181ba221c76c"
},
"downloads": -1,
"filename": "detectlanguage-2.0.0.tar.gz",
"has_sig": false,
"md5_digest": "c2975297660c880dd8bb098fe0d8cb00",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5223,
"upload_time": "2025-08-20T16:47:51",
"upload_time_iso_8601": "2025-08-20T16:47:51.216088Z",
"url": "https://files.pythonhosted.org/packages/d2/67/3a3b478b85a4f989062a9d2f16e26c4a2e358e60fb62a606c75b4b64e8db/detectlanguage-2.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-20 16:47:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "detectlanguage",
"github_project": "detectlanguage-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "requests",
"specs": [
[
">=",
"1.2.0"
]
]
}
],
"lcname": "detectlanguage"
}