Spaces:
Sleeping
Sleeping
| from dotenv import load_dotenv, find_dotenv | |
| import os | |
| def getenvvar(varname): | |
| # needed to strip env var of any remaining quotes - might be added by deployment scripts | |
| val = os.environ.get(varname) | |
| if val is None: | |
| f"Environment variable {varname} not found" | |
| else: | |
| return val.strip('"').strip("'") | |
| def load_credentials(): | |
| load_dotenv(find_dotenv()) # take environment variables from .env. | |
| apikey = getenvvar("WXAI_APIKEY") | |
| apiendpoint = getenvvar("WXAI_ENDPOINT") | |
| projectid = getenvvar("WXAI_PROJECT") | |
| status = apiendpoint is not None and apikey is not None and projectid is not None | |
| return status, apiendpoint, apikey, projectid |