Receiving HTTP post using Flask

The server side of my data logger is a very simple Flask site.

First version of the code:

from flask import Flask, request, abort
app = Flask(__name__)

import datetime

@app.route('/')
def index():
    return "nothing to see here ..."

@app.route('/input/', methods=['POST', 'GET'])
def input():
    if request.headers.get('X-ApiKey') != 'SECRET_API_KEY_SET_ON_ARDUINO':
        abort(403)
    if request.method == 'POST':
        log_to_file(request.data)
    return "OK"

def log_to_file(data):
    f = open('/tmp/arduino.logger', 'a')
    f.write(str(datetime.datetime.now()))
    f.write(': ')
    f.write(data)
    f.write("\n")
    f.close()