MAJOR: solves problem related to ELABFTW_API_URL variable
if no value was specified for such variable (or .env was missing) EAU would be set to None and get stuck in a prompt loop solved by turning EAU into a required variable in APIHandler (and editing a lot of code through all of src/)
This commit is contained in:
@@ -23,11 +23,11 @@ class APIHandler:
|
||||
# TO-DO: remove static url.
|
||||
def __init__(self, api_key="", ELABFTW_API_URL=None):
|
||||
"""Init method, api_key suggested but not required (empty by default)."""
|
||||
if not ELABFTW_API_URL:
|
||||
load_dotenv()
|
||||
ELABFTW_API_URL = os.getenv("ELABFTW_API_URL") or input(
|
||||
"Enter a valid eLabFTW API URL (ends with '/api/v2)': "
|
||||
)
|
||||
# if not ELABFTW_API_URL:
|
||||
# load_dotenv()
|
||||
# ELABFTW_API_URL = os.getenv("ELABFTW_API_URL") or input(
|
||||
# "Enter a valid eLabFTW API URL (ends with '/api/v2)': "
|
||||
# )
|
||||
self.api_key = api_key
|
||||
self.auth = {"Authorization": api_key}
|
||||
self.content = {"Content-Type": "application/json"}
|
||||
|
||||
Reference in New Issue
Block a user