<commit_before>#! /usr/bin/python3

from bottle import get, post, run, request

from db import init_db, add_one_url


@get('/<:re:.*>')
def index():
    return """
        <form action="/" method="post">
            URL: <input name="aviurl" type="text" size=60 /><br>
            TITLE: <input name="avitil" type="text" size=60 />
            <input value="Submit" type="submit" />
        </form>
        """


@post('/')  # or @route('/login', method='POST')
def do_post():
    aviurl = request.forms.get('aviurl')
    avitil = request.forms.get('avitil')
    add_one_url(aviurl, avitil)
    #fout = open("url_post.txt", "a")
    #fout.write(aviurl + "\n")
    #fout.close()
    return index() + ("<br>got<p>%s<br>%s</p>" % (avitil, aviurl))<commit_msg>add html_*<commit_after>#! /usr/bin/python3

from bottle import get, post, run, request

from db import init_db, add_one_url


def html_head():
    return """
        <html>
        <head><title>You-Get</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf8">
        </head>
        <body>
        """


def html_foot():
    return "</body></html>"


def html_form():
    return """
        <form action="/" method="post">
            URL: <input name="aviurl" type="text" size=60 /><br>
            TITLE: <input name="avitil" type="text" size=60 />
            <input value="Submit" type="submit" />
        </form>
        """


@get('/<:re:.*>')
def index():
    return html_head() + html_form() + html_foot()


@post('/')  # or @route('/login', method='POST')
def do_post():
    aviurl = request.forms.get('aviurl')
    avitil = request.forms.get('avitil')
    print(avitil)
    add_one_url(aviurl, avitil)
    #fout = open("url_post.txt", "a")
    #fout.write(aviurl + "\n")
    #fout.close()
    return html_head() + index() + (
           "<br>got<p>%s<br>%s</p>" % (avitil, aviurl)) + html_foot()
{'fraction_non_alphanumeric': 0.2044491525423729, 'fraction_numerical': 0.005826271186440678, 'mean_word_length': 2.778, 'pattern_counts': {'":': 0, '<': 34, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3649730', 'n_tokens_mistral': 699, 'n_tokens_neox': 685, 'n_words': 142}