How to use the quart.render_template function in Quart

To help you get started, we’ve selected a few Quart examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github synesthesiam / voice2json / mqtt / app.py View on Github external
custom_words_text = form["custom_words"]
            custom_words_path.write_text(custom_words_text)
        elif action == "pronounce":
            # Speak or guess pronunciation
            word = form["word"]
            if len(word) > 0:
                # Get multiple guesses
                result = voice2json("pronounce-word", "--quiet", "--nbest", "3", word)
                for line in result:
                    phonemes = re.split(r"\s+", line.strip(), maxsplit=1)[1]
                    guesses.append(phonemes)

    # Load custom words
    custom_words_text = custom_words_path.read_text()

    return await render_template(
        "words.html",
        page="words",
        profile=profile,
        pydash=pydash,
        custom_words=custom_words_text,
        word=word,
        guesses=guesses,
        len=len,
    )
github synesthesiam / voice2json / mqtt / app.py View on Github external
# Load word examples for each phoneme
    phoneme_examples_path = Path(
        pydash.get(profile, "speech-to-text.phoneme-examples-file")
    )

    phoneme_examples = {}
    with open(phoneme_examples_path, "r") as phoneme_examples_file:
        for line in phoneme_examples_file:
            line = line.strip()
            if len(line) == 0 or line.startswith("#"):
                continue

            phoneme, word, pronunciation = re.split(r"\s+", line, maxsplit=2)
            phoneme_examples[phoneme] = (word, pronunciation)

    return await render_template(
        "phonemes.html",
        page="phonemes",
        profile=profile,
        pydash=pydash,
        sorted=sorted,
        phoneme_examples=phoneme_examples,
    )
github OutlierVentures / ANVIL / anvil / prover.py View on Github external
have_data = True if received_data else False
    responded = True if 'connection_response' in prover else False
    '''
    The onboardee depends on the anchor to finish establishing the secure channel.
    However the request-reponse messaging means the onboardee cannot proceed until it is:
    the functions made available by the channel_established variable wait until the
    relevant response from the anchor is returned, which is only possible if the channel
    is set up on the anchor end.
    '''
    channel_established = True if anchor_ip else False
    have_verinym = True if 'did_info' in prover else False
    unique_schema_name = prover['unique_schema_name'] if 'unique_schema_name' in prover else False
    have_proof_request = True if 'authcrypted_proof_request' in prover else False
    stored_credentials_string = ', '.join(credential for credential in stored_credentials)
    # If stored credentials == credential offer, hide credential request
    return render_template('prover.html', actor = 'PROVER', setup = setup, have_data = have_data, request_ip = request_ip, responded = responded, channel_established = channel_established, have_verinym = have_verinym, stored_credentials = stored_credentials_string, unique_schema_name = unique_schema_name, have_proof_request = have_proof_request, multiple_onboard = multiple_onboard, service_published = service_published)
github pgjones / quart / examples / http2 / http2.py View on Github external
async def index():
    await make_push_promise(url_for('static', filename='http2.css'))
    await make_push_promise(url_for('static', filename='http2.js'))
    return await render_template('index.html')
github pgjones / quart / examples / websocket / websocket.py View on Github external
async def index():
    return await render_template('index.html')
github OutlierVentures / ANVIL / anvil / verifier.py View on Github external
have_data = True if received_data else False
    responded = True if 'connection_response' in verifier else False
    '''
    The onboardee depends on the anchor to finish establishing the secure channel.
    However the request-reponse messaging means the onboardee cannot proceed until it is:
    the functions made available by the channel_established variable wait until the
    relevant response from the anchor is returned, which is only possible if the channel
    is set up on the anchor end.
    '''
    channel_established = True if anchor_ip else False
    prover_registered = True if 'prover_ip' in verifier else False
    have_verinym = True if 'did_info' in verifier else False
    credential_requested = True if 'authcrypted_cred_request' in verifier else False
    have_proof = True if 'authcrypted_proof' in verifier else False
    search_results = verifier['search_results'].strip('"[]\'').replace(',', ', ') if 'search_results' in verifier else False
    return render_template('verifier.html', actor = 'VERIFIER', setup = setup, have_data = have_data, request_ip = request_ip, responded = responded, channel_established = channel_established, have_verinym = have_verinym, prover_registered = prover_registered, credential_requested = credential_requested, have_proof = have_proof, search_results = search_results)
github AceFire6 / ordered-arrowverse / ordering / views.py View on Github external
async def index_with_hidden(hide_list):
    context = {}

    episode_list = get_full_series_episode_list(hide_list)

    context['hidden_show_list'] = hide_list
    context['table_content'] = episode_list
    context['show_list'] = app.config['SHOW_DICT']

    return await render_template('index.html', **context)
github synesthesiam / voice2json / mqtt / app.py View on Github external
slots_yaml = form["slots"]
        slots_dict = yaml.safe_load(slots_yaml)
        slots_dir.mkdir(parents=True, exist_ok=True)
        for slot_name, slot_values in slots_dict.items():
            with open(slots_dir / slot_name, "w") as slot_file:
                for value in slot_values:
                    print(value.strip(), file=slot_file)

    else:
        slots_dict = slots_to_dict(slots_dir)
        if len(slots_dict) > 0:
            slots_yaml = yaml.dump(slots_dict)
        else:
            slots_yaml = ""

    return await render_template(
        "slots.html", page="slots", profile=profile, pydash=pydash, slots=slots_yaml
    )
github OutlierVentures / ANVIL / anvil / steward.py View on Github external
def index():
    global steward
    setup = True if steward else False
    channel_established = True if 'connection_response' in steward else False
    return render_template('steward.html', actor = 'STEWARD', setup = setup, channel_established = channel_established)
github Roxxers / roxbot / webapp / routes.py View on Github external
async def dashboard():
    roxbot_guilds = app.discord_client.guilds
    def filter_guilds(guild):
        g_ids = [str(x.id) for x in roxbot_guilds]
        if guild.get('id', 0) in g_ids:
            return True
        else:
            return False

    oauth_token = session.get('oauth2_token')
    discord_session = oauth.make_session(token=oauth_token)
    guilds = discord_session.get(webapp.API_BASE_URL + '/users/@me/guilds').json()
    guilds = list(filter(filter_guilds, guilds))
    user = discord_session.get(webapp.API_BASE_URL + '/users/@me').json()

    return await render_template(
        "dashboard.html",
        oauth_token=oauth_token,
        user=user,
        guilds=sorted(guilds, key=lambda k: k['name']),
        IMAGE_BASE_URL=webapp.IMAGE_BASE_URL
    )