Skip to content

armgit / fli

Public Imported from GitHub
0

Google Flights MCP, CLI and Python Library

Add `fli app` command

Punit Aranifbd9e9dbf8a8
diff --git a/README.md b/README.md
index 09a7526..204b368 100644
--- a/README.md
+++ b/README.md
@@ -3,6 +3,8 @@
A powerful Python library that provides programmatic access to Google Flights data with an elegant CLI interface. Search
flights, find the best deals, and filter results with ease.
+Try out the live demo at [flightly.streamlit.app](https://flightly.streamlit.app)
+
> 🚀 **What makes `fli` special?**
> Unlike other flight search libraries that rely on web scraping, Fli directly interacts with Google Flights' API
> through reverse engineering.
@@ -21,13 +23,14 @@ pip install flights
```
```bash
-# Install using pipx (recommended to use CLI)
+# Install using pipx (recommended for CLI and GUI)
pipx install flights
-```
-```bash
# Get started with CLI
fli --help
+
+# Launch the GUI
+fli app
```
## Features
diff --git a/docs/guides/quickstart.md b/docs/guides/quickstart.md
index b7b3b88..aaab506 100644
--- a/docs/guides/quickstart.md
+++ b/docs/guides/quickstart.md
@@ -10,7 +10,7 @@ This guide will help you get started with Fli quickly.
pip install flights
```
-### For CLI Usage
+### For CLI and GUI Usage
```bash
pipx install flights
@@ -18,6 +18,14 @@ pipx install flights
## Basic Usage
+### Application (GUI)
+
+```bash
+fli app
+```
+
+This will launch the Streamlit application at [http://localhost:3600](http://localhost:3600).
+
### Command Line Interface
1. Search for flights on a specific date:
diff --git a/fli/cli/commands/streamlit.py b/fli/cli/commands/streamlit.py
new file mode 100644
index 0000000..877c8bf
--- /dev/null
+++ b/fli/cli/commands/streamlit.py
@@ -0,0 +1,16 @@
+"""App command implementation."""
+
+import sys
+from pathlib import Path
+
+import streamlit.web.cli as stcli
+
+
+def streamlit() -> None:
+ """Launch the Streamlit app interface."""
+ # Get the path to main.py
+ app_path = Path(__file__).parents[2].joinpath("app", "main.py")
+
+ # Run the Streamlit app
+ sys.argv = ["streamlit", "run", str(app_path), "--server.port", "3600"]
+ sys.exit(stcli.main())
diff --git a/fli/cli/main.py b/fli/cli/main.py
index 19f79c7..10791d8 100644
--- a/fli/cli/main.py
+++ b/fli/cli/main.py
@@ -6,6 +6,7 @@ import typer
from fli.cli.commands.cheap import cheap
from fli.cli.commands.search import search
+from fli.cli.commands.streamlit import streamlit
app = typer.Typer(
help="Search for flights using Google Flights data",
@@ -13,8 +14,9 @@ app = typer.Typer(
)
# Register commands
-app.command(name="search")(search)
+app.command(name="app")(streamlit)
app.command(name="cheap")(cheap)
+app.command(name="search")(search)
@app.callback(invoke_without_command=True)
@@ -37,7 +39,7 @@ def cli():
return
# If the first argument isn't a command, treat as search
- if args[0] not in ["search", "cheap", "--help", "-h"]:
+ if args[0] not in ["app", "cheap", "search", "--help", "-h"]:
sys.argv.insert(1, "search")
app()