mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-02 08:31:16 +03:00
EDSM: Don't blindly assume we *already* have EDSM cmdr name and apikey
This commit is contained in:
parent
82d3897ae7
commit
7bae9afe02
@ -329,9 +329,17 @@ def credentials(cmdr: str) -> Optional[Tuple[str, str]]:
|
|||||||
cmdrs = [cmdr]
|
cmdrs = [cmdr]
|
||||||
config.set('edsm_cmdrs', cmdrs)
|
config.set('edsm_cmdrs', cmdrs)
|
||||||
|
|
||||||
if cmdr in cmdrs and config.get_list('edsm_usernames') and config.get_list('edsm_apikeys'):
|
if (cmdr in cmdrs and (edsm_usernames := config.get_list('edsm_usernames'))
|
||||||
|
and (edsm_apikeys := config.get_list('edsm_apikeys'))):
|
||||||
idx = cmdrs.index(cmdr)
|
idx = cmdrs.index(cmdr)
|
||||||
return (config.get_list('edsm_usernames')[idx], config.get_list('edsm_apikeys')[idx])
|
# The EDSM cmdr and apikey might not exist yet!
|
||||||
|
if idx >= len(edsm_usernames):
|
||||||
|
return None
|
||||||
|
|
||||||
|
if idx >= len(edsm_apikeys):
|
||||||
|
edsm_apikeys[idx] = None
|
||||||
|
|
||||||
|
return (edsm_usernames[idx], edsm_apikeys[idx])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user