Handle incorrectly formatted API tokens (Closes #1721)

This commit is contained in:
Mathieu Comandon 2019-02-06 11:49:11 -08:00
parent d6419533a2
commit 20f11abda1

View file

@ -24,7 +24,11 @@ def read_api_key():
return None
with open(API_KEY_FILE_PATH, "r") as token_file:
api_string = token_file.read()
username, token = api_string.split(":")
try:
username, token = api_string.split(":")
except ValueError:
logger.error("Unable to read Lutris token in %s", API_KEY_FILE_PATH)
return None
return {"token": token, "username": username}