


The first argument is a stringĬontaining the text you want to translate, or a list of strings if you want to To translate text, call translate_text(). Translator accepts additional options, see Configuration In production code, theĪuthentication key should not be hard-coded, but instead fetched from aĬonfiguration file or environment variable. This example is for demonstration purposes only. translate_text ( "Hello, world!", target_lang = "FR" ) print ( result. Translator ( auth_key ) result = translator. import deepl auth_key = "f63c02c5-f056-." # Replace with your key translator = deepl. The first argument is a stringĬontaining your API authentication key as found in yourīe careful not to expose your key, for example when sharing source code. Import the package and construct a Translator. The requests module is used to perform HTTP requests the minimum is version The library is tested with Python versions 3.6 to 3.11. Use the workaround sudo apt install python3-cachecontrol asĮxplained in this bug report. On Ubuntu 22.04 an error might occur: ModuleNotFoundError: No module named 'cachecontrol'. If you need to modify this source code, install the dependencies using poetry: poetry install The library can be installed from PyPI using pip: pip install -upgrade deepl With a DeepL API FreeĪccount you can translate up to 500,000 characters/month for free. To use the DeepL Python Library, you'll need an API authentication key. With the library, though support for new features may be added to the libraryĪfter they’re added to the API. The DeepL Python library offers a convenient way for applications written in This opens a whole universe of opportunities forĭevelopers: any translation product you can imagine can now be built on top ofĭeepL's best-in-class translation technology. The DeepL API is a language translation API that allows otherĬomputer programs to send texts and documents to DeepL's servers and receive
