mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-05 18:03:17 +03:00
Merge pull request #1137 from EDCD/fix/1134/edsm-multi-cmdr
EDSM: Don't blindly assume we *already* have EDSM cmdr name and apikey
This commit is contained in:
commit
752f4b78d7
@ -329,9 +329,14 @@ 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) or idx >= len(edsm_apikeys):
|
||||||
|
return None
|
||||||
|
|
||||||
|
return (edsm_usernames[idx], edsm_apikeys[idx])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user