Made some additions to login

This commit is contained in:
Clayton Wilson 2017-11-01 10:31:54 -04:00
parent 375a34daba
commit 9c4bcefa04
3 changed files with 5 additions and 2 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@
login.json login.json
api info.txt api info.txt
__pycache__ __pycache__
menuLayout.txt

View File

@ -108,6 +108,7 @@ def tryMissing(missingNums, min, max, idNum, imageType):
FAN_KEY_TYPE = "?keyType=fanart"# TODO check upper and lower bounds FAN_KEY_TYPE = "?keyType=fanart"# TODO check upper and lower bounds
POS_KEY_TYPE = "?keyType=poster" POS_KEY_TYPE = "?keyType=poster"
BAN_KEY_TYPE = "?keyType=series" BAN_KEY_TYPE = "?keyType=series"
token = getToken(url, data, headers)# TODO uppercase these token = getToken(url, data, headers)# TODO uppercase these

View File

@ -1,7 +1,7 @@
import json import json
import os.path import os.path
from checks import * from checks import *
import time import datetime
def login(): def login():
if os.path.exists("login.json") == False: if os.path.exists("login.json") == False:
@ -39,11 +39,12 @@ def login():
if tmp_token is "": if tmp_token is "":
print("Authentication failed. Please try again.") print("Authentication failed. Please try again.")
else: else:
with open("login.json") as json_data: with open("login.json") as json_data:
login["API_KEY"] = tmp_api_key login["API_KEY"] = tmp_api_key
login["USER_KEY"] = tmp_user_key login["USER_KEY"] = tmp_user_key
login["USER_NAME"] = tmp_user_name login["USER_NAME"] = tmp_user_name
login["TOKEN"] = tmp_token
login["TIMESTAMP"] = datetime.datetime.now()
obj = open("login.json", "w") obj = open("login.json", "w")
obj.write(json.dumps(login)) obj.write(json.dumps(login))
obj.close() obj.close()