handle error during splatnet maintenance & still generate gtoken

This commit is contained in:
eli fessler
2022-11-29 16:20:25 -10:00
parent 8758d29fc8
commit ed218d8612
2 changed files with 7 additions and 3 deletions

View File

@@ -395,8 +395,8 @@ def get_bullet(web_service_token, app_user_agent, user_lang, user_country):
bullet_token = bullet_resp["bulletToken"]
except (json.decoder.JSONDecodeError, TypeError):
print("Got non-JSON response from Nintendo (in api/bullet_tokens step):")
print(bullet_resp)
sys.exit(1)
print(r.text)
bullet_token = ""
except:
print("Error from Nintendo (in api/bullet_tokens step):")
print(json.dumps(bullet_resp, indent=2))

6
s3s.py
View File

@@ -170,7 +170,7 @@ def gen_new_tokens(reason, force=False):
print("Attempting to generate new gtoken and bulletToken...")
new_gtoken, acc_name, acc_lang, acc_country = iksm.get_gtoken(F_GEN_URL, SESSION_TOKEN, A_VERSION)
new_bullettoken = iksm.get_bullet(new_gtoken, APP_USER_AGENT, acc_lang, acc_country)
CONFIG_DATA["gtoken"] = new_gtoken # valid for 2 hours
CONFIG_DATA["gtoken"] = new_gtoken # valid for 6 hours
CONFIG_DATA["bullettoken"] = new_bullettoken # valid for 2 hours
global USER_LANG
@@ -180,6 +180,10 @@ def gen_new_tokens(reason, force=False):
write_config(CONFIG_DATA)
if new_bullettoken == "":
print("Wrote gtoken to config.txt, but could not generate bulletToken.")
print("Is SplatNet 3 undergoing maintenance?")
sys.exit(1)
if manual_entry:
print("Wrote tokens to config.txt.\n") # and updates acc_country if necessary...
else: