#!/bin/python3
'''
just a test
'''

import os
from flask import Flask, flash, request, send_file, g

app = Flask(__name__)

@app.after_request
def after_request(response):
    if request.path != '/ciao':
        return response
    os.remove(g.fname)
    print("Deleted {}\n\n".format(g.fname))
    return response

@app.route("/")
def hello():
    '''
    noting
    '''
    return 'Hello world'

@app.route("/ciao")
def ciao():
    fname='/tmp/MIOMIOMIO.txt'
    myfile=open(fname, 'w')
    myfile.write('PROVA\n'* 100)
    myfile.close()
    g.fname = fname
    return send_file(fname, as_attachment=True)
