fixed a few problems
parent
9d7c5a82cc
commit
82357f45c8
|
@ -68,7 +68,7 @@ def loadOfflineData(offlineDataFile = "offline.txt"):
|
||||||
offlineData = offlineData + [dataRaw[i].split("=")]
|
offlineData = offlineData + [dataRaw[i].split("=")]
|
||||||
|
|
||||||
def getDataOff2DArray(key, array):
|
def getDataOff2DArray(key, array):
|
||||||
for i in range(len(array):
|
for i in range(len(array)):
|
||||||
if array[i][0]==key:
|
if array[i][0]==key:
|
||||||
return array[i][1]
|
return array[i][1]
|
||||||
|
|
||||||
|
@ -84,6 +84,13 @@ def getToken(username, password):
|
||||||
try:
|
try:
|
||||||
request = urllib2.Request(url='https://authserver.mojang.com/authenticate', data=json.dumps(data).encode(), headers={"Content-Type": "application/json"})
|
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())
|
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:
|
except urllib2.URLError:
|
||||||
if main:
|
if main:
|
||||||
print "Authentication server not reachable. Re-launching last user session."
|
print "Authentication server not reachable. Re-launching last user session."
|
||||||
|
@ -92,13 +99,6 @@ def getToken(username, password):
|
||||||
else:
|
else:
|
||||||
#TODO: raise an exception
|
#TODO: raise an exception
|
||||||
return False, False, False
|
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']
|
username = answer['selectedProfile']['name']
|
||||||
access_token = answer['accessToken']
|
access_token = answer['accessToken']
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
username=LinuxMint4Ever
|
||||||
|
access_token=f63b458254964f3fa4bd7ccfff302ea9
|
||||||
|
profile_id=f8b426e586c04abf8e4dc5048f8719ac
|
Reference in New Issue