Files
grabowski af62cfef0b
Some checks failed
Security & Dependency Updates / Dependency Security Scan (push) Successful in 29s
Security & Dependency Updates / Docker Security Scan (push) Failing after 53s
Security & Dependency Updates / License Compliance (push) Successful in 13s
Security & Dependency Updates / Check for Dependency Updates (push) Successful in 19s
Security & Dependency Updates / Code Quality Metrics (push) Successful in 11s
Security & Dependency Updates / Security Summary (push) Successful in 7s
Initial commit: Northern Thailand Ping River Monitor v3.1.0
Features:
- Real-time water level monitoring for Ping River Basin (16 stations)
- Coverage from Chiang Dao to Nakhon Sawan in Northern Thailand
- FastAPI web interface with interactive dashboard and station management
- Multi-database support (SQLite, MySQL, PostgreSQL, InfluxDB, VictoriaMetrics)
- Comprehensive monitoring with health checks and metrics collection
- Docker deployment with Grafana integration
- Production-ready architecture with enterprise-grade observability

 CI/CD & Automation:
- Complete Gitea Actions workflows for CI/CD, security, and releases
- Multi-Python version testing (3.9-3.12)
- Multi-architecture Docker builds (amd64, arm64)
- Daily security scanning and dependency monitoring
- Automated documentation generation
- Performance testing and validation

 Production Ready:
- Type safety with Pydantic models and comprehensive type hints
- Data validation layer with range checking and error handling
- Rate limiting and request tracking for API protection
- Enhanced logging with rotation, colors, and performance metrics
- Station management API for dynamic CRUD operations
- Comprehensive documentation and deployment guides

 Technical Stack:
- Python 3.9+ with FastAPI and Pydantic
- Multi-database architecture with adapter pattern
- Docker containerization with multi-stage builds
- Grafana dashboards for visualization
- Gitea Actions for CI/CD automation
- Enterprise monitoring and alerting

 Ready for deployment to B4L infrastructure!
2025-08-12 15:40:24 +07:00

61 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""
Simple API test script
"""
import requests
import time
import json
def test_api_endpoints():
"""Test the main API endpoints"""
base_url = "http://localhost:8000"
endpoints = [
"/health",
"/metrics",
"/stations",
"/measurements/latest?limit=5",
"/scraping/status",
"/config"
]
print("🧪 Testing API endpoints...")
print("Make sure the API server is running: python run.py --web-api")
print()
for endpoint in endpoints:
try:
print(f"Testing {endpoint}...")
response = requests.get(f"{base_url}{endpoint}", timeout=5)
if response.status_code == 200:
data = response.json()
print(f"{endpoint} - Status: {response.status_code}")
# Show some sample data
if endpoint == "/stations":
print(f" Found {len(data)} stations")
elif endpoint == "/measurements/latest?limit=5":
print(f" Found {len(data)} measurements")
if data:
latest = data[0]
print(f" Latest: {latest['station_code']} - {latest['water_level']}m")
elif endpoint == "/health":
print(f" Overall status: {data.get('overall_status', 'unknown')}")
elif endpoint == "/scraping/status":
print(f" Is running: {data.get('is_running', False)}")
print(f" Total runs: {data.get('total_runs', 0)}")
else:
print(f"{endpoint} - Status: {response.status_code}")
except requests.exceptions.ConnectionError:
print(f"{endpoint} - Connection failed (is the server running?)")
except Exception as e:
print(f"{endpoint} - Error: {e}")
print()
if __name__ == "__main__":
test_api_endpoints()