<commit_before>import bottle
import bottle.ext.sqlite
import json

app = application = bottle.Bottle()
plugin = bottle.ext.sqlite.Plugin(dbfile='sensor_data.db')
app.install(plugin)

@app.route('/temperature_pressure', db, method='POST')
def temperature_data():
    for l in bottle.request.body:
        print (l)
    print (bottle.request.json)
    data = bottle.request.json


    temp = data["temperature"]
    
    c.execute("INSERT INTO temperature VALUES ('2006-01-05',?)", (temp,))

    pressure = data["pressure"]
    c.execute("INSERT INTO pressure VALUES ('2006-01-05',?)", (pressure,))

@app.route('/temperature', db, method='GET')
def temperature_data(db):
    #return bottle.template('<html><body>Hello World!</body></html>')
    temp = db.execute('SELECT * from temperature').fetchone()
    if temp:
        return bottle.template('<html><body> Latest temperature is: {{temp}} </body></html>', temp=temp)
    return HTTPError(404, "Page not found")<commit_msg>Fixed db arguments.<commit_after>import bottle
import bottle.ext.sqlite
import json

app = application = bottle.Bottle()
plugin = bottle.ext.sqlite.Plugin(dbfile='sensor_data.db')
app.install(plugin)

@app.route('/temperature_pressure', method='POST')
def temperature_data(db):
    for l in bottle.request.body:
        print (l)
    print (bottle.request.json)
    data = bottle.request.json


    temp = data["temperature"]
    
    c.execute("INSERT INTO temperature VALUES ('2006-01-05',?)", (temp,))

    pressure = data["pressure"]
    c.execute("INSERT INTO pressure VALUES ('2006-01-05',?)", (pressure,))

@app.route('/temperature', method='GET')
def temperature_data(db):
    #return bottle.template('<html><body>Hello World!</body></html>')
    temp = db.execute('SELECT * from temperature').fetchone()
    if temp:
        return bottle.template('<html><body> Latest temperature is: {{temp}} </body></html>', temp=temp)
    return HTTPError(404, "Page not found")
{'fraction_non_alphanumeric': 0.16786447638603696, 'fraction_numerical': 0.019507186858316223, 'mean_word_length': 4.383977900552487, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '2899875', 'n_tokens_mistral': 635, 'n_tokens_neox': 590, 'n_words': 139}