Ejemplo n.º 1
0
def random_thing(item: int = None):
    if item is None:
        item = random.randrange(len(things))
    return render_template(
        'index.html',
        item=item,
        thing=things[item],
    )
Ejemplo n.º 2
0
async def install(crypto_bot: CryptoBot, request: http.Request):
    """This route renders the installation page with 'Add to Slack' button."""
    # Since we've set the client ID and scope on our Bot object, we can change
    # them more easily while we're developing our app.
    logger.debug("SLACK EVENT install")

    # Our template is using the Jinja templating language to dynamically pass
    # our client id and scope
    return render_template(
        "install.html",
        client_id=crypto_bot.oauth['client_id'],
        scope=crypto_bot.oauth['scope'],
        redirect_uri=crypto_bot.redir_uri(request),
    )
Ejemplo n.º 3
0
async def thanks(code: str, state: str, crypto_bot: CryptoBot,
                 request: http.Request):
    """
    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.
    logger.debug("SLACK OAUTH thanks: %s", code)

    # The bot's auth method to handles exchanging the code for an OAuth token
    try:
        team_name = await crypto_bot.auth(code, crypto_bot.redir_uri(request))
    except Exception as e:
        logger.error("OAuth error: %s", e)
        return Response('Unable to authenticate!: %s' % e, status=500)

    return render_template("thanks.html", team_name=team_name)
Ejemplo n.º 4
0
def hello(username: str):
    return render_template('index.html', username=username)
Ejemplo n.º 5
0
def home():
    """
    Home page that serves <a>index.html</a> template.
    """
    return render_template('index.html')
Ejemplo n.º 6
0
def get_player_details(player_name: str):
    return render_template('index.html', player_name=player_name)
Ejemplo n.º 7
0
def home():
    return render_template('index.html')
Ejemplo n.º 8
0
def crate_detail(crate_id: int):
    template = "404.html"
    crate = Crate.get(pk=crate_id)
    if crate:
        template = "detail.html"
    return render_template(template, crate=crate)
Ejemplo n.º 9
0
def crate_list():
    crates = Crate.all()
    return render_template('home.html', crates=crates)