예제 #1
0
def listCharacters(bID=None, access_token=None, bUsername=None):
    ##########################################################
    # Returns list of blizzard characters from database.     #
    # Required input, oneof: bID, bUsername, or access_token #
    ##########################################################
    """Not complete"""
    if bID is not None:
        """do something"""
        #lookup accesstoken where bid = bid
        #use access_token below
        access_token = db.getToken(bid=bID)

    if bUsername is not None:
        """do something"""
        #lookup accesstoken where UID = bUsername
        #use access_token below
        access_token = db.getToken(username=bUsername)

    if access_token is not None:
        """do something"""
        #get json from wow and pull all characters
        data = getCharacters(access_token)
        return data
    else:
        raise ValueError(
            "No combination of values could produce a valid access_token in wow.listCharacters"
        )
예제 #2
0
def main():

    # Create the EventHandler and pass it your bot's token.
    updater = Updater(db.getToken())

    # Get the dispatcher to register handlers
    dp = updater.dispatcher

    # on different commands - answer in Telegram
    dp.add_handler(CommandHandler("start", start))
    dp.add_handler(CommandHandler("files", files))
    dp.add_handler(CommandHandler("help", help))

    # on noncommand i.e message - echo the message on Telegram
    dp.add_handler(MessageHandler([Filters.text], echo))

    # log all errors
    dp.add_error_handler(error)

    # Start the Bot
    updater.start_polling()

    # Run the bot until the you presses Ctrl-C or the process receives SIGINT,
    # SIGTERM or SIGABRT. This should be used most of the time, since
    # start_polling() is non-blocking and will stop the bot gracefully.
    updater.idle()
예제 #3
0
 def remove(issue_number, account, repo):
     url = '''https://api.github.com/repos/%(act)s/%(repo)s/issues/%(number)s?%(token)s'''\
         %{"token":db.getToken("tintapplication"),
           "act": account,
           "repo": repo,
           "number": issue_number}
     payload = {'state': 'closed'}
     response = requests.post(url, data=json.dumps(payload))
     return response
예제 #4
0
파일: issues.py 프로젝트: arirawr/tint
 def remove(issue_number, account, repo):
     url = '''https://api.github.com/repos/%(act)s/%(repo)s/issues/%(number)s?%(token)s'''\
         %{"token":db.getToken("tintapplication"),
           "act": account,
           "repo": repo,
           "number": issue_number}
     payload = {'state':'closed'}
     response = requests.post(url, data=json.dumps(payload))
     return response
예제 #5
0
 def signout(id):
     try:
          response = db.checkSession(id)
     except Exception as e:
         print(e)
         raise AppExceptions.Cant_Check_If_Task_Is_Comlete("AppExceptions.CantCheckIfSessionIsOpen")
     print(response)
     if (response == 1):
         try:
             db.closeSession(id)
         except Exception as e:
             print(e)
             raise AppExceptions.CantCloseSession("AppExceptions.CantCloseSession")
         try:
             token = db.getToken(id)
         except Exception as e:
             print(e)
             raise AppExceptions.CanGetToken("AppExceptions.CanGetToken")
         return token
     else:
         raise AppExceptions.NotAuthorized("AppExceptions.NotAuthorized")
예제 #6
0
    def __init__(self):
        logging.basicConfig(
            format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
            level=logging.INFO)

        try:
            self.updater = Updater(token=getToken())
            self.dispatcher = self.updater.dispatcher

            self.dispatcher.add_handler(
                MessageHandler(Filters.text, self.message))
            self.dispatcher.add_handler(CommandHandler('start', self.start))
            self.dispatcher.add_handler(
                CommandHandler('new_agenda', self.new_agenda, pass_args=True))
            self.dispatcher.add_handler(
                CommandHandler('list_agendas', self.list_agendas))
        except sqlite3.OperationalError:
            logging.critical(
                "The database was not initialized\n\tRun app.py -init_db TOKEN"
            )
            sys.exit(1)
예제 #7
0
    def signin(id, user_token):
         new_token = random.randint(0, 9999)
         try:
             old_token = db.getToken(id)
         except Exception as e:
             print(e)
             raise AppExceptions.CantGetToken("AppExceptions.CantGetToken")
         if (user_token == old_token):
            try:
                db.setToken(id, new_token)
            except Exception as e:
                print(e)
                raise AppExceptions.CantInsertNewToken("AppExceptions.CantInsertNewToken")

            try:
                db.openSession(id)
            except Exception as e:
                print(e)
                raise AppExceptions.CantOpenSession("AppExceptions.CantOpenSession")
            return True
         else:
            return False
예제 #8
0
 def __init__(self, title=None, body=None, assignee=None, labels=None):
     self.title = title
     self.body = body
     self.assignee = assignee
     self.labels = labels
     self.access_token = db.getToken("tintapplication")
예제 #9
0
파일: issues.py 프로젝트: arirawr/tint
 def __init__(self, title=None, body=None, assignee=None, labels=None):
     self.title = title
     self.body = body
     self.assignee = assignee
     self.labels = labels
     self.access_token = db.getToken("tintapplication")