pingera-cli 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pingera_cli-0.1.0/pingera_cli.egg-info → pingera_cli-0.1.2}/PKG-INFO +2 -2
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/README.md +1 -1
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/__init__.py +3 -3
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/commands/auth.py +52 -12
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/commands/checks.py +1 -1
- {pingera_cli-0.1.0 → pingera_cli-0.1.2/pingera_cli.egg-info}/PKG-INFO +2 -2
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/.gitignore +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/.replit +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/LICENSE +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/assert +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/docs/cli-commands.md +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/__main__.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/commands/__init__.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/commands/base.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/commands/on_demand_checks.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/formatters/__init__.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/formatters/base_formatter.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/formatters/generic_formatter.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/formatters/multistep_formatter.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/formatters/registry.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/formatters/ssl_formatter.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/formatters/synthetic_formatter.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/formatters/web_formatter.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/main.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/utils/__init__.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/utils/config.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli/utils/console.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli.egg-info/SOURCES.txt +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli.egg-info/dependency_links.txt +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli.egg-info/entry_points.txt +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli.egg-info/requires.txt +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pingera_cli.egg-info/top_level.txt +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/pyproject.toml +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/replit.md +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/run_tests.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/setup.cfg +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/setup.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/tests/__init__.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/tests/conftest.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/tests/requirements.txt +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/tests/test_auth.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/tests/test_checks.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/tests/test_config.py +0 -0
- {pingera_cli-0.1.0 → pingera_cli-0.1.2}/tests/test_on_demand_checks.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pingera-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A beautiful Python CLI tool built with typer and rich, distributed via pip and based on Pingera SDK
|
|
5
5
|
Home-page: https://github.com/pingera/pingera-cli
|
|
6
6
|
Author: PingeraCLI Team
|
|
@@ -57,7 +57,7 @@ A beautiful Python CLI tool for the [Pingera Platform](https://pingera.ru) - bui
|
|
|
57
57
|
|
|
58
58
|
- **Beautiful Terminal Output**: Powered by Rich library for colorful, formatted output
|
|
59
59
|
- **Modern CLI Interface**: Built with Typer for intuitive command-line interactions
|
|
60
|
-
- **Pingera Platform Integration**: Seamlessly integrates with Pingera SDK for
|
|
60
|
+
- **Pingera Platform Integration**: Seamlessly integrates with Pingera SDK for managing and running checks (statuspages and other coming soon)
|
|
61
61
|
- **Cross-Platform**: Works on Windows, macOS, and Linux
|
|
62
62
|
- **Easy Installation**: Simple pip install with all dependencies managed
|
|
63
63
|
- **Configuration Management**: Flexible configuration with environment variables and config files
|
|
@@ -11,7 +11,7 @@ A beautiful Python CLI tool for the [Pingera Platform](https://pingera.ru) - bui
|
|
|
11
11
|
|
|
12
12
|
- **Beautiful Terminal Output**: Powered by Rich library for colorful, formatted output
|
|
13
13
|
- **Modern CLI Interface**: Built with Typer for intuitive command-line interactions
|
|
14
|
-
- **Pingera Platform Integration**: Seamlessly integrates with Pingera SDK for
|
|
14
|
+
- **Pingera Platform Integration**: Seamlessly integrates with Pingera SDK for managing and running checks (statuspages and other coming soon)
|
|
15
15
|
- **Cross-Platform**: Works on Windows, macOS, and Linux
|
|
16
16
|
- **Easy Installation**: Simple pip install with all dependencies managed
|
|
17
17
|
- **Configuration Management**: Flexible configuration with environment variables and config files
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""
|
|
2
|
-
|
|
2
|
+
Pingera CLI - A beautiful CLI tool for Pingera Platform
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
__version__ = "0.1.
|
|
6
|
-
__author__ = "
|
|
5
|
+
__version__ = "0.1.2"
|
|
6
|
+
__author__ = "Pingera Team"
|
|
7
7
|
__description__ = "A beautiful Python CLI tool built with typer and rich, distributed via pip and based on Pingera SDK"
|
|
8
8
|
|
|
9
9
|
from .main import app
|
|
@@ -22,7 +22,7 @@ class AuthCommand(BaseCommand):
|
|
|
22
22
|
super().__init__()
|
|
23
23
|
self.app = typer.Typer(
|
|
24
24
|
name="auth",
|
|
25
|
-
help="🔐 Manage authentication settings",
|
|
25
|
+
help="🔐 Manage authentication settings\n\n💡 Get your API key at: https://app.pingera.ru",
|
|
26
26
|
no_args_is_help=True,
|
|
27
27
|
)
|
|
28
28
|
|
|
@@ -65,8 +65,12 @@ class AuthCommand(BaseCommand):
|
|
|
65
65
|
# Test the API key by making a simple request
|
|
66
66
|
self.console.print("🔍 Validating API key...")
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
validation_status = self._validate_api_key(api_key.strip())
|
|
69
|
+
self.console.print(f"API Key Status: {validation_status}")
|
|
70
|
+
|
|
71
|
+
if "[red]❌ Invalid or expired[/red]" in validation_status:
|
|
72
|
+
self.console.print("[red]Please check your API key and try again.[/red]")
|
|
73
|
+
raise typer.Exit(1)
|
|
70
74
|
|
|
71
75
|
# Save API key to config
|
|
72
76
|
if set_api_key(api_key.strip()):
|
|
@@ -114,15 +118,9 @@ Status: [green]Active[/green]
|
|
|
114
118
|
[dim]Note: Environment variable takes precedence over config file.[/dim]
|
|
115
119
|
"""
|
|
116
120
|
|
|
117
|
-
#
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
# # Test API key with a simple request
|
|
121
|
-
# client = PingeraClient.from_api_key(active_api_key)
|
|
122
|
-
# # Make a test request
|
|
123
|
-
# status_content += "\n[bold]API Status:[/bold] [green]✅ Valid[/green]"
|
|
124
|
-
# except Exception as e:
|
|
125
|
-
# status_content += f"\n[bold]API Status:[/bold] [red]❌ Invalid ({str(e)})[/red]"
|
|
121
|
+
# Validate API key
|
|
122
|
+
validation_status = self._validate_api_key(active_api_key)
|
|
123
|
+
status_content += f"\nAPI Key Check: {validation_status}"
|
|
126
124
|
|
|
127
125
|
else:
|
|
128
126
|
status_content = """
|
|
@@ -209,6 +207,48 @@ API Key: ✗ Not set
|
|
|
209
207
|
self.display_error(f"Logout failed: {str(e)}")
|
|
210
208
|
raise typer.Exit(1)
|
|
211
209
|
|
|
210
|
+
def _validate_api_key(self, api_key: str) -> str:
|
|
211
|
+
"""
|
|
212
|
+
Validate API key by making a test request
|
|
213
|
+
|
|
214
|
+
Args:
|
|
215
|
+
api_key: The API key to validate
|
|
216
|
+
|
|
217
|
+
Returns:
|
|
218
|
+
str: Formatted status message
|
|
219
|
+
"""
|
|
220
|
+
try:
|
|
221
|
+
# Import here to avoid circular imports and handle missing SDK gracefully
|
|
222
|
+
from pingera import ApiClient, Configuration
|
|
223
|
+
from pingera.api import ChecksApi
|
|
224
|
+
from pingera.exceptions import UnauthorizedException
|
|
225
|
+
|
|
226
|
+
# Configure the client (same pattern as checks command)
|
|
227
|
+
configuration = Configuration()
|
|
228
|
+
configuration.host = "https://api.pingera.ru"
|
|
229
|
+
configuration.api_key['apiKeyAuth'] = api_key
|
|
230
|
+
|
|
231
|
+
# Create API client
|
|
232
|
+
api_client = ApiClient(configuration)
|
|
233
|
+
checks_api = ChecksApi(api_client)
|
|
234
|
+
|
|
235
|
+
# Make a lightweight test request to validate the API key
|
|
236
|
+
checks_api.v1_checks_get()
|
|
237
|
+
|
|
238
|
+
return "[green]✅ Valid[/green]"
|
|
239
|
+
|
|
240
|
+
except ImportError:
|
|
241
|
+
return "[yellow]⚠ Cannot validate (Pingera SDK not available)[/yellow]"
|
|
242
|
+
except UnauthorizedException:
|
|
243
|
+
return "[red]❌ Invalid or expired[/red]"
|
|
244
|
+
except Exception as e:
|
|
245
|
+
# Handle other API errors gracefully
|
|
246
|
+
error_msg = str(e).lower()
|
|
247
|
+
if "network" in error_msg or "connection" in error_msg or "timeout" in error_msg:
|
|
248
|
+
return "[yellow]⚠ Cannot validate (network error)[/yellow]"
|
|
249
|
+
else:
|
|
250
|
+
return f"[yellow]⚠ Cannot validate ({str(e)})[/yellow]"
|
|
251
|
+
|
|
212
252
|
|
|
213
253
|
# Create the auth command instance
|
|
214
254
|
auth_cmd = AuthCommand()
|
|
@@ -879,7 +879,7 @@ class ChecksCommand(BaseCommand):
|
|
|
879
879
|
raise typer.Exit(1)
|
|
880
880
|
|
|
881
881
|
# Create Typer app for checks commands
|
|
882
|
-
app = typer.Typer(name="checks", help="🔍 Manage monitoring checks")
|
|
882
|
+
app = typer.Typer(name="checks", help="🔍 Manage monitoring checks", no_args_is_help=True)
|
|
883
883
|
|
|
884
884
|
|
|
885
885
|
def get_output_format():
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pingera-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A beautiful Python CLI tool built with typer and rich, distributed via pip and based on Pingera SDK
|
|
5
5
|
Home-page: https://github.com/pingera/pingera-cli
|
|
6
6
|
Author: PingeraCLI Team
|
|
@@ -57,7 +57,7 @@ A beautiful Python CLI tool for the [Pingera Platform](https://pingera.ru) - bui
|
|
|
57
57
|
|
|
58
58
|
- **Beautiful Terminal Output**: Powered by Rich library for colorful, formatted output
|
|
59
59
|
- **Modern CLI Interface**: Built with Typer for intuitive command-line interactions
|
|
60
|
-
- **Pingera Platform Integration**: Seamlessly integrates with Pingera SDK for
|
|
60
|
+
- **Pingera Platform Integration**: Seamlessly integrates with Pingera SDK for managing and running checks (statuspages and other coming soon)
|
|
61
61
|
- **Cross-Platform**: Works on Windows, macOS, and Linux
|
|
62
62
|
- **Easy Installation**: Simple pip install with all dependencies managed
|
|
63
63
|
- **Configuration Management**: Flexible configuration with environment variables and config files
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|