proxywhirl.tui¶
Terminal User Interface (TUI) for ProxyWhirl.
Full-featured TUI with proxy sourcing, validation, analytics, health monitoring, exports, and configuration management.
## Features
Overview Tab: Real-time metrics dashboard and proxy table with color-coded health status
Fetch & Validate: Auto-fetch from all built-in proxy sources with batch validation
Export: Save proxy lists in CSV, JSON, YAML, or plain text formats
Test: Send HTTP requests (GET/POST/PUT/DELETE/HEAD/PATCH/OPTIONS) through proxies
Analytics: Statistics by protocol, country, and source
Health Tab: Circuit breaker status and health check controls
## Usage
- Launch via CLI:
$ proxywhirl tui
- Or programmatically:
>>> from proxywhirl import ProxyWhirl, run_tui >>> rotator = ProxyWhirl() >>> run_tui(rotator=rotator)
## Keyboard Shortcuts
Ctrl+C: Quit
Ctrl+R: Refresh all data
Ctrl+F: Go to Fetch & Validate tab
Ctrl+E: Go to Export tab
Ctrl+T: Go to Test tab
Delete: Delete selected proxy
Enter: View proxy details
F1: Show help
## Architecture
The TUI uses Textual framework with the following components: - MetricsPanel: Reactive metrics display - RetryMetricsPanel: Retry statistics display - ProxyTable: DataTable with health status indicators, filtering, and sorting - FilterPanel: Search and filter controls - SourceFetcherPanel: Multi-source proxy fetching - ExportPanel: Multi-format export functionality - StrategyPanel: Rotation strategy management - RequestTesterPanel: HTTP request testing with custom headers/body - AnalyticsPanel: Statistics and insights - ProxyControlPanel: Manual proxy management - HealthCheckPanel: Batch health checking with progress - CircuitBreakerPanel: Circuit breaker status display - ProxyDetailsScreen: Modal for detailed proxy information - ConfirmDeleteScreen: Deletion confirmation dialog
Classes¶
Panel for analytics and statistics. |
|
Panel for displaying circuit breaker states. |
|
Modal screen for confirming proxy deletion. |
|
Panel for exporting proxy lists. |
|
Panel for filtering the proxy table. |
|
Panel for running health checks. |
|
Modal screen showing comprehensive help information. |
|
Display real-time metrics with sparkline visualization. |
|
Panel for manually adding and removing proxies. |
|
Modal screen showing detailed proxy information. |
|
DataTable widget for displaying proxies with row selection and sorting. |
|
ProxyWhirl TUI Application. |
|
Panel for testing proxy requests. |
|
Panel for displaying retry metrics. |
|
Panel for fetching proxies from sources. |
|
Status bar showing current app state and quick stats. |
|
Panel for managing rotation strategies. |
Functions¶
|
Run the TUI application. |
Module Contents¶
- class proxywhirl.tui.AnalyticsPanel(content='', *, expand=False, shrink=False, markup=True, name=None, id=None, classes=None, disabled=False)[source]¶
Bases:
textual.widgets.StaticPanel for analytics and statistics.
Initialize a Widget.
- Parameters:
*children – Child widgets.
name (str | None) – The name of the widget.
id (str | None) – The ID of the widget in the DOM.
classes (str | None) – The CSS classes for the widget.
disabled (bool) – Whether the widget is disabled or not.
markup (bool) – Enable content markup?
content (textual.visual.VisualType)
expand (bool)
shrink (bool)
- class proxywhirl.tui.CircuitBreakerPanel(content='', *, expand=False, shrink=False, markup=True, name=None, id=None, classes=None, disabled=False)[source]¶
Bases:
textual.widgets.StaticPanel for displaying circuit breaker states.
Initialize a Widget.
- Parameters:
*children – Child widgets.
name (str | None) – The name of the widget.
id (str | None) – The ID of the widget in the DOM.
classes (str | None) – The CSS classes for the widget.
disabled (bool) – Whether the widget is disabled or not.
markup (bool) – Enable content markup?
content (textual.visual.VisualType)
expand (bool)
shrink (bool)
- class proxywhirl.tui.ConfirmDeleteScreen(proxy_url, *args, **kwargs)[source]¶
Bases:
textual.screen.ModalScreenModal screen for confirming proxy deletion.
Initialize with proxy URL to delete.
- Parameters:
proxy_url (str)
- class proxywhirl.tui.ExportPanel(content='', *, expand=False, shrink=False, markup=True, name=None, id=None, classes=None, disabled=False)[source]¶
Bases:
textual.widgets.StaticPanel for exporting proxy lists.
Initialize a Widget.
- Parameters:
*children – Child widgets.
name (str | None) – The name of the widget.
id (str | None) – The ID of the widget in the DOM.
classes (str | None) – The CSS classes for the widget.
disabled (bool) – Whether the widget is disabled or not.
markup (bool) – Enable content markup?
content (textual.visual.VisualType)
expand (bool)
shrink (bool)
- class proxywhirl.tui.FilterPanel(content='', *, expand=False, shrink=False, markup=True, name=None, id=None, classes=None, disabled=False)[source]¶
Bases:
textual.widgets.StaticPanel for filtering the proxy table.
Initialize a Widget.
- Parameters:
*children – Child widgets.
name (str | None) – The name of the widget.
id (str | None) – The ID of the widget in the DOM.
classes (str | None) – The CSS classes for the widget.
disabled (bool) – Whether the widget is disabled or not.
markup (bool) – Enable content markup?
content (textual.visual.VisualType)
expand (bool)
shrink (bool)
- class proxywhirl.tui.HealthCheckPanel(content='', *, expand=False, shrink=False, markup=True, name=None, id=None, classes=None, disabled=False)[source]¶
Bases:
textual.widgets.StaticPanel for running health checks.
Initialize a Widget.
- Parameters:
*children – Child widgets.
name (str | None) – The name of the widget.
id (str | None) – The ID of the widget in the DOM.
classes (str | None) – The CSS classes for the widget.
disabled (bool) – Whether the widget is disabled or not.
markup (bool) – Enable content markup?
content (textual.visual.VisualType)
expand (bool)
shrink (bool)
- class proxywhirl.tui.HelpScreen(name=None, id=None, classes=None)[source]¶
Bases:
textual.screen.ModalScreenModal screen showing comprehensive help information.
Initialize the screen.
- Parameters:
- class proxywhirl.tui.MetricsPanel(content='', *, expand=False, shrink=False, markup=True, name=None, id=None, classes=None, disabled=False)[source]¶
Bases:
textual.widgets.StaticDisplay real-time metrics with sparkline visualization.
Initialize a Widget.
- Parameters:
*children – Child widgets.
name (str | None) – The name of the widget.
id (str | None) – The ID of the widget in the DOM.
classes (str | None) – The CSS classes for the widget.
disabled (bool) – Whether the widget is disabled or not.
markup (bool) – Enable content markup?
content (textual.visual.VisualType)
expand (bool)
shrink (bool)
- class proxywhirl.tui.ProxyControlPanel(content='', *, expand=False, shrink=False, markup=True, name=None, id=None, classes=None, disabled=False)[source]¶
Bases:
textual.widgets.StaticPanel for manually adding and removing proxies.
Initialize a Widget.
- Parameters:
*children – Child widgets.
name (str | None) – The name of the widget.
id (str | None) – The ID of the widget in the DOM.
classes (str | None) – The CSS classes for the widget.
disabled (bool) – Whether the widget is disabled or not.
markup (bool) – Enable content markup?
content (textual.visual.VisualType)
expand (bool)
shrink (bool)
- class proxywhirl.tui.ProxyDetailsScreen(proxy, *args, **kwargs)[source]¶
Bases:
textual.screen.ModalScreenModal screen showing detailed proxy information.
Initialize with proxy data.
- Parameters:
proxy (proxywhirl.models.Proxy)
- class proxywhirl.tui.ProxyTable(*args, **kwargs)[source]¶
Bases:
textual.widgets.DataTableDataTable widget for displaying proxies with row selection and sorting.
Initialize with row cursor for selection.
- get_selected_proxy()[source]¶
Get the currently selected proxy.
- Return type:
proxywhirl.models.Proxy | None
- set_sort(column)[source]¶
Set sort column, toggling direction if same column.
- Parameters:
column (str)
- Return type:
None
- class proxywhirl.tui.ProxyWhirlTUI(rotator=None)[source]¶
Bases:
textual.app.AppProxyWhirl TUI Application.
Initialize TUI.
- Parameters:
rotator (proxywhirl.rotator.ProxyWhirl | None)
- action_import_proxies()[source]¶
Import proxies from clipboard or show import dialog.
- Return type:
None
- add_proxy()[source]¶
Add a proxy manually. Supports multiple proxies separated by newlines.
- Return type:
None
- export_proxies(healthy_only=False)[source]¶
Export proxies to file.
- Parameters:
healthy_only (bool)
- Return type:
None
- filter_country_changed(event)[source]¶
Handle country filter change.
- Parameters:
event (textual.widgets.Select.Changed)
- Return type:
None
- filter_favorites_changed(event)[source]¶
Handle favorites filter change.
- Parameters:
event (textual.widgets.Checkbox.Changed)
- Return type:
None
- filter_health_changed(event)[source]¶
Handle health filter change.
- Parameters:
event (textual.widgets.Select.Changed)
- Return type:
None
- filter_protocol_changed(event)[source]¶
Handle protocol filter change.
- Parameters:
event (textual.widgets.Select.Changed)
- Return type:
None
- filter_search_changed(event)[source]¶
Handle search filter change.
- Parameters:
event (textual.widgets.Input.Changed)
- Return type:
None
- async quick_test_proxy_async(proxy)[source]¶
Async worker for quick proxy test.
- Parameters:
proxy (proxywhirl.models.Proxy)
- Return type:
None
- sort_column(event)[source]¶
Handle column header click for sorting.
- Parameters:
event (textual.widgets.DataTable.HeaderSelected)
- Return type:
None
- BINDINGS = [('ctrl+c', 'quit', 'Quit'), ('ctrl+r', 'refresh', 'Refresh'), ('ctrl+f', 'fetch', 'Fetch...[source]¶
The default key bindings.
- SUB_TITLE = 'Intelligent Proxy Rotation'[source]¶
A class variable to set the default sub-title for the application.
To update the sub-title while the app is running, you can set the [sub_title][textual.app.App.sub_title] attribute. See also [the Screen.SUB_TITLE attribute][textual.screen.Screen.SUB_TITLE].
- class proxywhirl.tui.RequestTesterPanel(content='', *, expand=False, shrink=False, markup=True, name=None, id=None, classes=None, disabled=False)[source]¶
Bases:
textual.widgets.StaticPanel for testing proxy requests.
Initialize a Widget.
- Parameters:
*children – Child widgets.
name (str | None) – The name of the widget.
id (str | None) – The ID of the widget in the DOM.
classes (str | None) – The CSS classes for the widget.
disabled (bool) – Whether the widget is disabled or not.
markup (bool) – Enable content markup?
content (textual.visual.VisualType)
expand (bool)
shrink (bool)
- class proxywhirl.tui.RetryMetricsPanel(content='', *, expand=False, shrink=False, markup=True, name=None, id=None, classes=None, disabled=False)[source]¶
Bases:
textual.widgets.StaticPanel for displaying retry metrics.
Initialize a Widget.
- Parameters:
*children – Child widgets.
name (str | None) – The name of the widget.
id (str | None) – The ID of the widget in the DOM.
classes (str | None) – The CSS classes for the widget.
disabled (bool) – Whether the widget is disabled or not.
markup (bool) – Enable content markup?
content (textual.visual.VisualType)
expand (bool)
shrink (bool)
- class proxywhirl.tui.SourceFetcherPanel(content='', *, expand=False, shrink=False, markup=True, name=None, id=None, classes=None, disabled=False)[source]¶
Bases:
textual.widgets.StaticPanel for fetching proxies from sources.
Initialize a Widget.
- Parameters:
*children – Child widgets.
name (str | None) – The name of the widget.
id (str | None) – The ID of the widget in the DOM.
classes (str | None) – The CSS classes for the widget.
disabled (bool) – Whether the widget is disabled or not.
markup (bool) – Enable content markup?
content (textual.visual.VisualType)
expand (bool)
shrink (bool)
- class proxywhirl.tui.StatusBar(content='', *, expand=False, shrink=False, markup=True, name=None, id=None, classes=None, disabled=False)[source]¶
Bases:
textual.widgets.StaticStatus bar showing current app state and quick stats.
Initialize a Widget.
- Parameters:
*children – Child widgets.
name (str | None) – The name of the widget.
id (str | None) – The ID of the widget in the DOM.
classes (str | None) – The CSS classes for the widget.
disabled (bool) – Whether the widget is disabled or not.
markup (bool) – Enable content markup?
content (textual.visual.VisualType)
expand (bool)
shrink (bool)
- class proxywhirl.tui.StrategyPanel(content='', *, expand=False, shrink=False, markup=True, name=None, id=None, classes=None, disabled=False)[source]¶
Bases:
textual.widgets.StaticPanel for managing rotation strategies.
Initialize a Widget.
- Parameters:
*children – Child widgets.
name (str | None) – The name of the widget.
id (str | None) – The ID of the widget in the DOM.
classes (str | None) – The CSS classes for the widget.
disabled (bool) – Whether the widget is disabled or not.
markup (bool) – Enable content markup?
content (textual.visual.VisualType)
expand (bool)
shrink (bool)