cannin / enhance_nlp_interaction_network_gsoc2020

3 stars 4 forks source link

Use .env File to Encode Configuration #14

Open cannin opened 4 years ago

cannin commented 4 years ago

You probably have several configuration variables (like maxret=20 for eutils or similar parameters), can you use a .env file for them?

https://pypi.org/project/python-dotenv/

Sample Code

from dotenv import load_dotenv, find_dotenv

# LOAD PARAMETERS ----
load_dotenv(find_dotenv())

## Credentials
USERNAME = os.environ.get("USERNAME")

If you can find a way to automatically do the os.environ.get step that'd be great, but I'm not sure there is one.