Skip to content

Commit

Permalink
add silent flag to read_dotenv function to suppress UserWarnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Izzy committed Feb 14, 2020
1 parent c68fd4b commit 2170ea8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dotenv.py
Expand Up @@ -34,7 +34,7 @@
""", re.IGNORECASE | re.VERBOSE)


def read_dotenv(dotenv=None, override=False):
def read_dotenv(dotenv=None, override=False, silent=False):
"""
Read a .env file into os.environ.
Expand All @@ -60,7 +60,7 @@ def read_dotenv(dotenv=None, override=False):
os.environ[k] = v
else:
os.environ.setdefault(k, v)
else:
elif not silent:
warnings.warn("Not reading {0} - it doesn't exist.".format(dotenv),
stacklevel=2)

Expand Down

0 comments on commit 2170ea8

Please sign in to comment.