File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -40,12 +40,14 @@ The `requests` module is used to perform HTTP requests; the minimum is version 2
40
40
41
41
``` python
42
42
import deepl
43
- import os
44
43
45
44
# Create a Translator object providing your DeepL API authentication key.
46
- # To avoid writing your key in source code, you can set it in an environment
47
- # variable DEEPL_AUTH_KEY, then read the variable in your Python code:
48
- translator = deepl.Translator(os.getenv(" DEEPL_AUTH_KEY" ))
45
+ # Be careful not to expose your key, for example when sharing source code.
46
+ auth_key = " f63c02c5-f056-..." # Replace with your key
47
+ translator = deepl.Translator(auth_key)
48
+ # This example is for demonstration purposes only. In production code, the
49
+ # authentication key should not be hard-coded, but instead fetched from a
50
+ # configuration file or environment variable.
49
51
50
52
# Translate text into a target language, in this case, French
51
53
result = translator.translate_text(" Hello, world!" , target_lang = " FR" )
You can’t perform that action at this time.
0 commit comments