Skip to main content

Detect Language API Python Client

PyPI version Build Status

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 for breaking changes.

Configuration

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

detectlanguage.detect("Dolce far niente")

Result

[{'language': 'it', 'score': 0.5074}]

Detect single code

If you need just a language code you can use detect_code.

detectlanguage.detect_code("Dolce far niente")

Result

'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.

detectlanguage.detect_batch(["Dolce far niente", "Hello world"])

Result

Result is array of detections in the same order as the texts were passed.

[[{'language': 'it', 'score': 0.5074}], [{'language': 'en', 'score': 0.9098}]]

Get your account status

detectlanguage.account_status()

Result

{ '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

detectlanguage.languages()

Result

[{'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.

Release files for detectlanguage 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for detectlanguage 2.0.0
File Size Uploaded
detectlanguage-2.0.0.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for detectlanguage 2.0.0
File Interpreter ABI Platform
detectlanguage-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.6 kB

Release files / detectlanguage-2.0.0.tar.gz

Download URL detectlanguage-2.0.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2746b629744b9603156df4bd528e09506be49c00edaa2ee02310181ba221c76c
BLAKE2b-256 checksum
How to use checksums
d2673a3b478b85a4f989062a9d2f16e26c4a2e358e60fb62a606c75b4b64e8db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2025.

Transparency log

Release files / detectlanguage-2.0.0-py3-none-any.whl

Download URL detectlanguage-2.0.0-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24fe10946284e113d34267b8026c388df291e1d94f922d2c55b6a79fedaed68d
BLAKE2b-256 checksum
How to use checksums
8bcb18fa7f4451855645a70c2d757c22eeaed8b23a3c633b150db11d85f874c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.5.0

1 release file

1.4.0

1 release file

1.3.0

1 release file

1.2.1

1 release file

1.1.1

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page