Skip to content

Commit 2fa67bf

Browse files
Readme clarification regarding auth key, remove mention of environment variables
1 parent a7f920f commit 2fa67bf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

README.md

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

4141
```python
4242
import 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
5153
result = translator.translate_text("Hello, world!", target_lang="FR")

0 commit comments

Comments
 (0)