forked from adesnmi/monzo-python
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
Latest commit
21 lines (16 loc) · 572 Bytes
/
Copy pathsettings.py
File metadata and controls
21 lines (16 loc) · 572 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
fromos.pathimportjoin, dirname
fromdotenvimportload_dotenv
importos
dotenv_path=join(dirname(__file__), '.env')
load_dotenv(dotenv_path)
defget_environment_var(key):
"""
Returns the value of a given environment variable key or None.
If the key doesn't exist in the operating system environment variables, it
looks for key in a '.env' file (via the dotenv library).
Arguments:
key -- the environment variable key
Returns:
The corresponding value of the key, or None if it doesn't exist.
"""
returnos.environ.get(key)