<prompt> Gaaffiiwwan dhufan hunda marsariitii tokko irratti calaluuf sagantaa middleware barreessinan  <response>: Sagantaan middleware jechuun qaama sooftiweerii web server fi application gidduu taaee gaaffii osoo application hin gaiin dura intercept gochuu fi adeemsisudha. Fakkeenyi sagantaa giddugaleessaa salphaa Paayitooniin barreeffame kan gaaffiiwwan dhufan hunda marsariitii irratti calaluuf unka weeb Flask fayyadamuun kunooti: python from flask import Flask, request, abort app Flask__name__ app.before_request def filter_requests : Loojikii calaqqee kee asitti dabali yoo request.headers.getAPI-KEY SECRET_KEY: abort401 Daandiiwwan kee asitti ibsi app.route def home : return Baga gara marsariitichaatti dhuftan! if __name__ __main__: app.run Fakkeenya kana keessatti, faankishiniin filter_requests faaya beefore_request tiin faayama, kana jechuun gaaffiin kamiyyuu osoo hin adeemsifamin dura ni raawwatama. Faankishinii kana keessatti, gaaffiin mataduree API-KEY gatii SECRET_KEY qabu qabaachuu isaa sakattaaa jirra. Yoo matadureen hin jirre ykn gatii sirrii hin taane, gaaffiin dogongora HTTP 401 Hin hayyamamneen ni addaan cita. Loojikii calaqqee amala mataa keetii dabaluudhaaf faankishinii filter_requests fooyyessuu fi dheeressuu dandeessa. Fakkeenyaaf, IP gaaffii tarree gurraacha irratti sakattauu, mala gaaffii sakattauu, feumsa gaaffii ykn mataduree mirkaneessuu fi kkf ni dandeessa. Middleware gaaffii sana erga adeemsisee booda gara route handler barbaachisaa taetti darba, bakka applicationn adeemsisee deebii maddisiisuu dandautti. 