I have built an api which accepts any filepath passed to it in the url and displays it in the webpage. Example: http://12.389.798.220:5000/C:/MYES/ALL.pdf
The webpage will display
C:/MYES/ALL.pdf
Now I want to take this output and pass it to the function 'convert' in my code which needs a filepath to process a file and return an output.
Code till now:
app = Flask(__name__)
api = Api(app)
class ectdtext(Resource):
def get(self, result):
return {'data': ectd.convert(result)}
categories=convert('/FILES/5cf9-5b67-45ef8-9DD69c-ae571431c665.pdf')
@app.route('/')
def returnResult():
return categories
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def get_dir(path):
return path
if __name__ == '__main__':
app.run(host="0.0.0.0", port=5000)
So, the line
categories=convert('/FILES/5cf9-5b67-45ef8-9DD69c-ae571431c665.pdf)
was previously hardcoded. Now I want to pass the path entered in the webpage to be passed as a parameter to this convert function for each new request. How can I solve this?