Skip to content

Commit 3ae1c57

Browse files
authored
add load_dotenv() to ensure environment variables are loaded
This PR adds `load_dotenv()` in the instruction to ensure that environment variables, such as `ES_LOCAL_PASSWORD`, are properly loaded when using the Python Elasticsearch client.
1 parent 7e22bb5 commit 3ae1c57

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

README.asciidoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ For example, to connect with the Python `elasticsearch` client:
136136
import os
137137
from elasticsearch import Elasticsearch
138138
139+
load_dotenv()
140+
139141
username = 'elastic'
140142
password = os.getenv('ELASTIC_PASSWORD') # Value you set in the environment variable
141143

0 commit comments

Comments
 (0)