Coverage for mpcforces_extractor\app.py: 0%
13 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-06 21:34 +0100
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-06 21:34 +0100
1import webbrowser
2import threading
3import time
4import uvicorn
5from mpcforces_extractor.api.main import app
8def open_browser():
9 """
10 Opens the browser to the main page of the app
11 """
12 # Delay opening the browser to allow the server to start
13 time.sleep(1) # Adjust the delay as needed
14 webbrowser.open("http://127.0.0.1:8000/", new=2)
17def main():
18 """
19 This is the main function that is used to run MPCForceExtractor
20 """
21 # Start a new thread to open the browser shortly after the server starts
22 threading.Thread(target=open_browser).start()
24 # Run the uvicorn server
25 uvicorn.run(app, host="127.0.0.1", port=8000, log_level="info")
28if __name__ == "__main__":
29 main()