def gen_new_cookie(reason): '''Attempts to generate new cookie in case provided one is invalid.''' if reason == "blank": print("Blank cookie.") elif reason == "auth": # authentication error print("The stored cookie has expired.") else: # server error or player hasn't battled before print("Cannot access SplatNet 2 without having played at least one battle online.") exit(1) new_cookie = iksm.enter_cookie() # error handling in enter_cookie() config_data["cookie"] = new_cookie write_config(config_data) print("Wrote iksm_session cookie to config.txt.")
def gen_new_cookie(reason): '''Attempts to generate a new cookie in case the provided one is invalid.''' manual = False if reason == "blank": print("Blank cookie.") elif reason == "auth": # authentication error print("The stored cookie has expired.") else: # server error or player hasn't battled before print("Cannot access SplatNet 2 without having played at least one battle online.") sys.exit(1) if SESSION_TOKEN == "": print("session_token is blank. Please log in to your Nintendo Account to obtain your session_token.") new_token = iksm.log_in(A_VERSION) if new_token == None: print("There was a problem logging you in. Please try again later.") else: if new_token == "skip": # user has opted to manually enter cookie manual = True print("\nYou have opted against automatic cookie generation and must manually input your iksm_session cookie.\n") else: print("\nWrote session_token to config.txt.") config_data["session_token"] = new_token write_config(config_data) elif SESSION_TOKEN == "skip": manual = True print("\nYou have opted against automatic cookie generation and must manually input your iksm_session cookie. You may clear this setting by removing \"skip\" from the session_token field in config.txt.\n") if manual: new_cookie = iksm.enter_cookie() else: print("Attempting to generate new cookie...") acc_name, new_cookie = iksm.get_cookie(SESSION_TOKEN, USER_LANG, A_VERSION) config_data["cookie"] = new_cookie write_config(config_data) if manual: print("Wrote iksm_session cookie to config.txt.") else: print("Wrote iksm_session cookie for {} to config.txt.".format(acc_name))
def gen_new_cookie(reason): '''Attempts to generate new cookie in case provided one is invalid.''' manual = False if reason == "blank": print("Blank cookie.") elif reason == "auth": #authentication error print("The stored cookie has expired.") else: #server error or player hasn't battled before print("Cannnot access SplatNet 2 without having played at least one") exit(1) if SESSION_TOKEN == "": print("session_token is blank.Please log in to your Nintendo Account") new_token = iksm.log_in(A_VERSION) if new_token == None: print("There was a problem logging you in. Please try again later") else: if new_token == "skip": #user has opted to manually enter cookie manual = True print("\nYou have opted against automatic cookie generation\n") else: print("\nWrote session_token to config.txt.") config_data["session_token"] = new_token write_config(config_data) elif SESSION_TOKEN == "skip": manual = True print("\nYOu have opted against automatic") if manual: new_cookie = iksm.enter_cookie() else: new_cookie = iksm.get_cookie(SESSION_TOKEN, USER_LANG, A_VERSION) config_data["cookie"] = new_cookie write_config(config_data) print("Wrote iksm_session cookie to config.txt.")