This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
2021-05-16 17:08:42 +02:00
|
|
|
# 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
|
2021-05-16 17:41:36 +02:00
|
|
|
@app.route("/split-pdf")
|
2021-05-16 17:08:42 +02:00
|
|
|
def index():
|
2021-05-16 17:41:36 +02:00
|
|
|
pdf = PDF('/tmp/split_pdf/')
|
2021-05-16 17:08:42 +02:00
|
|
|
try:
|
|
|
|
pdf.split()
|
|
|
|
return 200
|
|
|
|
except Exception as e:
|
|
|
|
return abort(500)
|
|
|
|
|
|
|
|
#run the app
|
|
|
|
if __name__ == "__main__":
|
|
|
|
app.run()
|