コード例 #1
0
def db_test():
    try:
        DBHelper.connect()
        DBHelper.create_db_tables()
        return str(Token.select().count())
    finally:
        DBHelper.close()
コード例 #2
0
def thanks():
    DBHelper.create_db_tables()  # trying to create db tables
    """
    This route is called by Slack after the user installs our app. It will
    exchange the temporary authorization code Slack sends for an OAuth token
    which we'll save on the bot object to use later.
    To let the user know what's happened it will also render a thank you page.
    """
    # Let's grab that temporary authorization code Slack's sent us from
    # the request's parameters.
    code_arg = request.args.get('code')
    # The bot's auth method to handles exchanging the code for an OAuth token
    pyBot.auth(code_arg)
    return render_template("thanks.html")
コード例 #3
0
        datetime.date.today().strftime(DateFormats.COMMON))


@application.route('/db_test')
def db_test():
    try:
        DBHelper.connect()
        DBHelper.create_db_tables()
        return str(Token.select().count())
    finally:
        DBHelper.close()


@application.route('/dialog', methods=["GET", "POST"])
def dialog():
    google_dialog = GoogleActionDialog(request,
                                       kult_menuholder.get_current_menu())
    return google_dialog.handle()


@application.after_request
def after_request(response):
    DBHelper.close()  # close if necessary
    return response


if __name__ == '__main__':
    logging.getLogger().setLevel(logging.DEBUG)
    DBHelper.create_db_tables()
    application.run(debug=True)