pingera-cli 0.1.1__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.
Files changed (44) hide show
  1. {pingera_cli-0.1.1/pingera_cli.egg-info → pingera_cli-0.1.2}/PKG-INFO +1 -1
  2. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/__init__.py +1 -1
  3. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/commands/auth.py +51 -11
  4. {pingera_cli-0.1.1 → pingera_cli-0.1.2/pingera_cli.egg-info}/PKG-INFO +1 -1
  5. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/.gitignore +0 -0
  6. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/.replit +0 -0
  7. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/LICENSE +0 -0
  8. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/README.md +0 -0
  9. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/assert +0 -0
  10. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/docs/cli-commands.md +0 -0
  11. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/__main__.py +0 -0
  12. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/commands/__init__.py +0 -0
  13. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/commands/base.py +0 -0
  14. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/commands/checks.py +0 -0
  15. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/commands/on_demand_checks.py +0 -0
  16. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/formatters/__init__.py +0 -0
  17. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/formatters/base_formatter.py +0 -0
  18. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/formatters/generic_formatter.py +0 -0
  19. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/formatters/multistep_formatter.py +0 -0
  20. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/formatters/registry.py +0 -0
  21. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/formatters/ssl_formatter.py +0 -0
  22. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/formatters/synthetic_formatter.py +0 -0
  23. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/formatters/web_formatter.py +0 -0
  24. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/main.py +0 -0
  25. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/utils/__init__.py +0 -0
  26. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/utils/config.py +0 -0
  27. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli/utils/console.py +0 -0
  28. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli.egg-info/SOURCES.txt +0 -0
  29. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli.egg-info/dependency_links.txt +0 -0
  30. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli.egg-info/entry_points.txt +0 -0
  31. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli.egg-info/requires.txt +0 -0
  32. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pingera_cli.egg-info/top_level.txt +0 -0
  33. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/pyproject.toml +0 -0
  34. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/replit.md +0 -0
  35. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/run_tests.py +0 -0
  36. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/setup.cfg +0 -0
  37. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/setup.py +0 -0
  38. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/tests/__init__.py +0 -0
  39. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/tests/conftest.py +0 -0
  40. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/tests/requirements.txt +0 -0
  41. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/tests/test_auth.py +0 -0
  42. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/tests/test_checks.py +0 -0
  43. {pingera_cli-0.1.1 → pingera_cli-0.1.2}/tests/test_config.py +0 -0
  44. {pingera_cli-0.1.1 → 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.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
@@ -2,7 +2,7 @@
2
2
  Pingera CLI - A beautiful CLI tool for Pingera Platform
3
3
  """
4
4
 
5
- __version__ = "0.1.1"
5
+ __version__ = "0.1.2"
6
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
 
@@ -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
- # For now, we'll skip API validation since we need to implement the client first
69
- # TODO: Add actual API key validation with Pingera SDK
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
- # TODO: Add API key validation request here
118
- # Example:
119
- # try:
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()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pingera-cli
3
- Version: 0.1.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
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