I have multiple HTML files that are all stored locally. I wrote a Python script with Whoosh to create an index to search the content of these files. I also have a Python script with Whoosh code to search this index based on a query. Now I want to add the search results into the HTML files. How can I add Python code to local HTML files?
My biggest restriction is that I have no access to a server, everything has to run locally. I need to embed Python code in HTML files without accessing a server.
You should have a look at Python Flask. It creates a local server that you can server your html from and create JavaScript to call Python methods that access your Whoosh index.
To get started have a look at the minimal Flask application
From your html page do a XMLHttpRequest to the url http://127.0.0.1:5000/queryIdex/yourQuery and then parse the returned json.