From 82357f45c896647265552301f8ebca1c194f0db7 Mon Sep 17 00:00:00 2001 From: LinuxMint4Ever <> Date: Fri, 2 Aug 2019 01:36:36 +0200 Subject: [PATCH] fixed a few problems --- earlyLauncher/earlylauncher.py | 16 ++++++++-------- earlyLauncher/offline.txt | 3 +++ 2 files changed, 11 insertions(+), 8 deletions(-) create mode 100644 earlyLauncher/offline.txt diff --git a/earlyLauncher/earlylauncher.py b/earlyLauncher/earlylauncher.py index ed483fc..d01de5e 100644 --- a/earlyLauncher/earlylauncher.py +++ b/earlyLauncher/earlylauncher.py @@ -68,7 +68,7 @@ def loadOfflineData(offlineDataFile = "offline.txt"): offlineData = offlineData + [dataRaw[i].split("=")] def getDataOff2DArray(key, array): - for i in range(len(array): + for i in range(len(array)): if array[i][0]==key: return array[i][1] @@ -84,6 +84,13 @@ def getToken(username, password): try: request = urllib2.Request(url='https://authserver.mojang.com/authenticate', data=json.dumps(data).encode(), headers={"Content-Type": "application/json"}) answer = json.loads(urllib2.urlopen(request).read().decode()) + except urllib2.HTTPError: + if main: + print "Invalid user information! (or something went wrong)" + sys.exit(1) + else: + #TODO: raise an exception + return False, False, False except urllib2.URLError: if main: print "Authentication server not reachable. Re-launching last user session." @@ -92,13 +99,6 @@ def getToken(username, password): else: #TODO: raise an exception return False, False, False - except urllib2.HTTPError: - if main: - print "Invalid user information! (or something went wrong)" - sys.exit(1) - else: - #TODO: raise an exception - return False, False, False username = answer['selectedProfile']['name'] access_token = answer['accessToken'] diff --git a/earlyLauncher/offline.txt b/earlyLauncher/offline.txt new file mode 100644 index 0000000..26b1421 --- /dev/null +++ b/earlyLauncher/offline.txt @@ -0,0 +1,3 @@ +username=LinuxMint4Ever +access_token=f63b458254964f3fa4bd7ccfff302ea9 +profile_id=f8b426e586c04abf8e4dc5048f8719ac \ No newline at end of file