def amazon_data(self):
     if exists('login'):
         with open('login', 'rb+') as loginfile:
             logincred = loginfile.readlines()
         ama_email = logincred[0].split(':')[1]
         passwd = logincred[1].split(':')[1].rstrip()
         passwd = base64.b64decode(passwd)
         print passwd
         ama_pass = decrypt(secret_key, passwd)
         print get_amazon_data(ama_email, ama_pass)
         self.gdButton1['state'] = 'disabled'
     else:
         window = Toplevel()
         AmaInit = AmazonInitialLogin(window)
         window.focus_set()
 def amazon_data(self):
     if exists('login'):
         with open('login', 'rb+') as loginfile:
             logincred = loginfile.readlines()
         ama_email = logincred[0].split(':')[1]
         passwd = logincred[1].split(':')[1].rstrip()
         passwd = base64.b64decode(passwd)
         print passwd
         ama_pass = decrypt(secret_key, passwd)
         print get_amazon_data(ama_email, ama_pass)
         self.gdButton1['state'] = 'disabled'
     else:
         window = Toplevel()
         AmaInit = AmazonInitialLogin(window)
         window.focus_set()
    def check_login_success(self):
        email = self.email.get()
        passwd = self.password.get()
        accountnum = self.accountnum.get()
        if email == "" or passwd == "" or accountnum == "":
            self.ErrorMsg["text"] = "No field should be blank."

        else:
            if "@" in email:
                amazon_fetch_result = get_amazon_data(email, passwd)
                if amazon_fetch_result != "Login Error" and amazon_fetch_result != "There was a problem":
                    with open("login", "wb+") as loginfile:
                        loginfile.write("login:"******"\n")
                        loginfile.write("passwd:" + encrypted(passwd) + "\n")
                        loginfile.write("account:" + accountnum)
                    quit(self)
                else:
                    self.ErrorMsg["text"] = "Error Logging in! Username/Password may be incorrect."
            else:
                self.ErrorMsg["text"] = "Incorrectly formatted email supplied."
    def check_login_success(self):
        email = self.email.get()
        passwd = self.password.get()
        accountnum = self.accountnum.get()
        if email == '' or passwd == '' or accountnum == '':
            self.ErrorMsg['text'] = "No field should be blank."

        else:
            if '@' in email:
                amazon_fetch_result = get_amazon_data(email, passwd)
                if amazon_fetch_result != "Login Error" and amazon_fetch_result != "There was a problem":
                    with open('login', 'wb+') as loginfile:
                        loginfile.write('login:'******'\n')
                        loginfile.write('passwd:' + encrypted(passwd) + '\n')
                        loginfile.write('account:' + accountnum)
                    quit(self)
                else:
                    self.ErrorMsg[
                        'text'] = "Error Logging in! Username/Password may be incorrect."
            else:
                self.ErrorMsg['text'] = "Incorrectly formatted email supplied."