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
4040
4141``` python
4242import deepl
43- import os
4443
4544# 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.
4951
5052# Translate text into a target language, in this case, French
5153result = translator.translate_text(" Hello, world!" , target_lang = " FR" )
You can’t perform that action at this time.
0 commit comments