You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
translation API that allows other computer programs to send texts and documents to DeepL's servers and receive
9
-
high-quality translations. This opens a whole universe of opportunities for developers: any translation product you can
10
-
imagine can now be built on top of DeepL's best-in-class translation technology.
7
+
The [DeepL API][api-docs] is a language translation API that allows other
8
+
computer programs to send texts and documents to DeepL's servers and receive
9
+
high-quality translations. This opens a whole universe of opportunities for
10
+
developers: any translation product you can imagine can now be built on top of
11
+
DeepL's best-in-class translation technology.
11
12
12
-
The DeepL Python library offers a convenient way for applications written in Python to interact with the DeepL API. We
13
-
intend to support all API functions with the library, though support for new features may be added to the library after
14
-
they’re added to the API.
13
+
The DeepL Python library offers a convenient way for applications written in
14
+
Python to interact with the DeepL API. We intend to support all API functions
15
+
with the library, though support for new features may be added to the library
16
+
after they’re added to the API.
15
17
18
+
## Getting an authentication key
16
19
17
-
## Getting an authentication key
20
+
To use the DeepL Python Library, you'll need an API authentication key. To get a
21
+
key, [please create an account here][create-account]. You can translate up to
22
+
500,000 characters/month for free.
18
23
19
-
To use the DeepL Python Library, you'll need an API authentication key. To get a key, [please create an account here][create-account]. You can translate up to 500,000 characters/month for free.
20
-
21
-
After you have created an account, you can find your API authentication key on your [DeepL Pro Account][pro-account].
24
+
After you have created an account, you can find your API authentication key on
25
+
your [DeepL Pro Account][pro-account].
22
26
23
27
## Installation
28
+
24
29
The library can be installed from [PyPI][pypi-project] using pip:
30
+
25
31
```shell
26
32
pip install --upgrade deepl
27
33
```
28
34
29
35
If you need to modify this source code, install the dependencies using poetry:
36
+
30
37
```shell
31
38
poetry install
32
39
```
33
40
34
41
### Requirements
35
-
The library is tested with Python versions 3.6 to 3.10.
36
42
37
-
The `requests` module is used to perform HTTP requests; the minimum is version 2.0.
43
+
The library is tested with Python versions 3.6 to 3.10.
44
+
45
+
The `requests` module is used to perform HTTP requests; the minimum is version
46
+
2.0.
38
47
39
48
## Usage
40
49
@@ -55,7 +64,8 @@ print(result) # "Bonjour, le monde !"
55
64
# Note: printing or converting the result to a string uses the output text
56
65
57
66
# Translate multiple texts into British English
58
-
result = translator.translate_text(["お元気ですか?", "¿Cómo estás?"], target_lang="EN-GB")
67
+
result = translator.translate_text(["お元気ですか?", "¿Cómo estás?"],
68
+
target_lang="EN-GB")
59
69
print(result[0].text) # "How are you?"
60
70
print(result[0].detected_source_lang) # "JA"
61
71
print(result[1].text) # "How are you?"
@@ -77,7 +87,8 @@ except deepl.DocumentTranslationException as error:
77
87
# DeepL support.
78
88
doc_id = error.document_handle.id
79
89
doc_key = error.document_handle.key
80
-
print(f"Error after uploading document ${error}, id: ${doc_id} key: ${doc_key}")
90
+
print(
91
+
f"Error after uploading document ${error}, id: ${doc_id} key: ${doc_key}")
0 commit comments