Beispiel #1
0
 def regenerate_auth(self):
     token = self.tokens[self.count]
     if self.tokens.index(token) == len(self.tokens) - 1:
         self.count = 0
     else:
         self.count += 1
     self.jotform_api = JotformAPIClient(token)
Beispiel #2
0
 def __init__(self):
     self.latest = None
     self.entrance_webhook = 'https://discordapp.com/api/webhooks/721531220479049868/9AaNPBSNi3fYt0sL-AJ8M_UGqmS0dRHx_ZEiWDUYOPj8XtfHK8k4ZC0P0ok6eLCz1aP6'
     self.count = 0
     self.tokens = [
         '17df4208b37eb80324e68805b6bce15a',
         '83285c23f180db2702c30f7eaba34382',
         '985a737612e7cdcb5edeae88a5b66c67',
         'be70837a6313c19b28226e18a4c2e258',
         '5834536ae379568cb112b78ef92ca208'
     ]
     self.jotform_api = JotformAPIClient(random.choice(self.tokens))
    def login(self, force_new=False):
        """Read API key from file or request one from user, create API-client."""
        from jotform import JotformAPIClient
        print "Creating client... ",
        user = self.user
        try:
            assert (force_new == False)
            with open(".%s_jotform_API_key.txt" % user, "r") as f:
                api_key = f.readline()
            print "sucsessfully read API key from file"

        except:
            print "failed to find API key. Please generate one at http://www." \
                  "jotform.com/myaccount/api and paste it here."
            api_key = raw_input("API_key: ")

            # Write API key to file for future use
            with open(".%s_jotform_API_key.txt" % user, "w") as f:
                f.write(api_key)
            print "API key has been saved to file for future use."

        self.client = JotformAPIClient(api_key, debug=True)