Skip to content

Commit 503bf28

Browse files
Suggest using environment variable for auth key in README
1 parent 80f9b78 commit 503bf28

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ The `requests` module is used to perform HTTP requests; the minimum is version 2
4040

4141
```python
4242
import deepl
43+
import os
4344

44-
# Create a Translator object providing your DeepL API authentication key
45-
translator = deepl.Translator("YOUR_AUTH_KEY")
45+
# 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"))
4649

4750
# Translate text into a target language, in this case, French
4851
result = translator.translate_text("Hello, world!", target_lang="FR")

0 commit comments

Comments
 (0)