From: Sam Mirazi Date: Mon, 2 Jun 2025 04:30:08 +0000 (-0700) Subject: 15 X-Git-Url: https://git.josue.xyz/?a=commitdiff_plain;h=ff37c6743b9331c7fc4a4dc9e5528ddd35611631;p=fastapi-vs-flask%2F.git 15 --- diff --git a/run_benchmark_table.py b/run_benchmark_table.py index 0bb3e7f..9c4ba1f 100644 --- a/run_benchmark_table.py +++ b/run_benchmark_table.py @@ -2,6 +2,7 @@ import subprocess import time import re import requests # pip install requests +import webbrowser # Added import from rich.console import Console from rich.table import Table import sys @@ -231,6 +232,14 @@ if __name__ == "__main__": if parsed: results.append({"framework": sc["name"], "config": sc["config"], "delay": sc["delay"], **parsed}) + # Open browser after benchmark completes to avoid interference + try: + console.print(f"[blue]Opening {sc['name']} page at {sc['url']} in browser...[/blue]") + webbrowser.open(sc["url"]) + console.print(f"[blue]Keeping server alive for 5 seconds to view the page...[/blue]") + time.sleep(5) # Keep server alive for 5 seconds + except Exception as e: + console.print(f"[yellow]Could not open browser for {sc['name']}: {e}[/yellow]") finally: stop_server(srv, sc["name"]) console.print()