add the basic API file

This commit is contained in:
Andreas Zweili 2021-05-16 17:08:42 +02:00
parent c78632d046
commit 8915f7794d
1 changed files with 22 additions and 0 deletions

22
api.py Normal file
View File

@ -0,0 +1,22 @@
# importing the flask library files
from flask import Flask
from flask import abort
from .pdf import PDF
#create flask web app object
app = Flask(__name__)
# define http route
@app.route("/")
def index():
pdf = PDF('/home/andreas/split_pdf/')
try:
pdf.split()
return 200
except Exception as e:
return abort(500)
#run the app
if __name__ == "__main__":
app.run()