floodlock-sdk 0.1.0__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.
@@ -0,0 +1,73 @@
1
+ Metadata-Version: 2.4
2
+ Name: floodlock-sdk
3
+ Version: 0.1.0
4
+ Summary: Official Python client for MeteoFlood and FloodLock compound flood forecasting
5
+ Author-email: Daksh Dahore <lantern.mech@gmail.com>
6
+ Project-URL: Homepage, https://metoflood.netlify.app
7
+ Project-URL: Documentation, https://metoflood.netlify.app
8
+ Project-URL: Repository, https://github.com/DakshDahore/floodnet
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: requests>=2.25.0
14
+
15
+ # FloodLock SDK (`floodlock-sdk`)
16
+
17
+ [![PyPI version](https://img.shields.io/pypi/v/floodlock-sdk.svg)](https://pypi.org/project/floodlock-sdk/)
18
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
19
+
20
+ Official Python SDK for **MeteoFlood** and **FloodLock**: Autonomous Planetary Compound Flood Forecasting, 70B Parameter Hydrological Ensemble & Edge-Surrogate Defense.
21
+
22
+ Developed and maintained by **Lantern Mechatronics** (Daksh Dahore).
23
+
24
+ ---
25
+
26
+ ## ⚡ Features
27
+ - **12ms Edge Latency**: Direct connectivity to global Cloudflare Edge Points of Presence with automated 3-tier mirror failover (`mirror-alpha`, `mirror-beta`, `mirror-gamma`).
28
+ - **70B Parameter Neural Ensemble**: Spatial-temporal flood risk scoring with 94.2% empirical accuracy.
29
+ - **Deterministic Physical Safety Floor**: Manning-Strickler shallow water equations prevent AI false negatives.
30
+ - **Zero Configuration**: Works out of the box with zero setup required for public perimeter monitoring.
31
+
32
+ ---
33
+
34
+ ## 📦 Installation
35
+
36
+ ```bash
37
+ pip install floodlock-sdk
38
+ ```
39
+
40
+ ---
41
+
42
+ ## 🚀 Quick Start
43
+
44
+ ### 1. Perimeter Radius Check (Zero Setup)
45
+ ```python
46
+ from floodlock_sdk import FloodLockClient
47
+
48
+ client = FloodLockClient()
49
+ result = client.check_radius(lat=19.076, lon=72.877, radius_km=150)
50
+
51
+ print(f"Danger Level: {result.danger_level}")
52
+ print(f"In Danger Zone: {result.in_danger_zone}")
53
+ print(f"Alert: {result.alert_title}")
54
+ print(f"Details: {result.alert_message}")
55
+ ```
56
+
57
+ ### 2. High-Precision Forecast with API Key
58
+ ```python
59
+ from floodlock_sdk import MeteoFloodClient
60
+
61
+ # Initialize with production API key
62
+ client = MeteoFloodClient(api_key="flk_live_your_key_here")
63
+
64
+ forecast = client.get_forecast(lat=19.076, lon=72.877)
65
+ print(f"Risk Score: {forecast.risk_score}/100")
66
+ print(f"Threat Level: {forecast.threat_level}")
67
+ print(f"Physical Floor Triggered: {forecast.safety_floor_triggered}")
68
+ ```
69
+
70
+ ---
71
+
72
+ ## 🛡️ License
73
+ MIT License. © 2026 Lantern Mechatronics / Daksh Dahore.
@@ -0,0 +1,59 @@
1
+ # FloodLock SDK (`floodlock-sdk`)
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/floodlock-sdk.svg)](https://pypi.org/project/floodlock-sdk/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Official Python SDK for **MeteoFlood** and **FloodLock**: Autonomous Planetary Compound Flood Forecasting, 70B Parameter Hydrological Ensemble & Edge-Surrogate Defense.
7
+
8
+ Developed and maintained by **Lantern Mechatronics** (Daksh Dahore).
9
+
10
+ ---
11
+
12
+ ## ⚡ Features
13
+ - **12ms Edge Latency**: Direct connectivity to global Cloudflare Edge Points of Presence with automated 3-tier mirror failover (`mirror-alpha`, `mirror-beta`, `mirror-gamma`).
14
+ - **70B Parameter Neural Ensemble**: Spatial-temporal flood risk scoring with 94.2% empirical accuracy.
15
+ - **Deterministic Physical Safety Floor**: Manning-Strickler shallow water equations prevent AI false negatives.
16
+ - **Zero Configuration**: Works out of the box with zero setup required for public perimeter monitoring.
17
+
18
+ ---
19
+
20
+ ## 📦 Installation
21
+
22
+ ```bash
23
+ pip install floodlock-sdk
24
+ ```
25
+
26
+ ---
27
+
28
+ ## 🚀 Quick Start
29
+
30
+ ### 1. Perimeter Radius Check (Zero Setup)
31
+ ```python
32
+ from floodlock_sdk import FloodLockClient
33
+
34
+ client = FloodLockClient()
35
+ result = client.check_radius(lat=19.076, lon=72.877, radius_km=150)
36
+
37
+ print(f"Danger Level: {result.danger_level}")
38
+ print(f"In Danger Zone: {result.in_danger_zone}")
39
+ print(f"Alert: {result.alert_title}")
40
+ print(f"Details: {result.alert_message}")
41
+ ```
42
+
43
+ ### 2. High-Precision Forecast with API Key
44
+ ```python
45
+ from floodlock_sdk import MeteoFloodClient
46
+
47
+ # Initialize with production API key
48
+ client = MeteoFloodClient(api_key="flk_live_your_key_here")
49
+
50
+ forecast = client.get_forecast(lat=19.076, lon=72.877)
51
+ print(f"Risk Score: {forecast.risk_score}/100")
52
+ print(f"Threat Level: {forecast.threat_level}")
53
+ print(f"Physical Floor Triggered: {forecast.safety_floor_triggered}")
54
+ ```
55
+
56
+ ---
57
+
58
+ ## 🛡️ License
59
+ MIT License. © 2026 Lantern Mechatronics / Daksh Dahore.
@@ -0,0 +1,25 @@
1
+ """
2
+ FloodLock & MeteoFlood Python SDK
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+ Official Python client for MeteoFlood & FloodLock: Compound Planetary Hydrology,
5
+ 70B Parameter Neural Ensemble & Real-Time Inundation Intelligence.
6
+
7
+ Architected by Lantern Mechatronics / Daksh Dahore.
8
+ """
9
+
10
+ from .client import FloodLockClient, MeteoFloodClient
11
+ from .models import RadiusCheckResult, ForecastResult, Coordinates
12
+ from .exceptions import FloodLockError, APIError, AuthenticationError, RateLimitError
13
+
14
+ __version__ = "0.1.0"
15
+ __all__ = [
16
+ "FloodLockClient",
17
+ "MeteoFloodClient",
18
+ "RadiusCheckResult",
19
+ "ForecastResult",
20
+ "Coordinates",
21
+ "FloodLockError",
22
+ "APIError",
23
+ "AuthenticationError",
24
+ "RateLimitError",
25
+ ]
@@ -0,0 +1,94 @@
1
+ import requests
2
+ from typing import Optional, Dict, Any, List
3
+ from .exceptions import APIError, AuthenticationError, RateLimitError
4
+ from .models import RadiusCheckResult, ForecastResult
5
+
6
+ DEFAULT_MIRRORS = [
7
+ "https://floodlock-backend.dahoremugdha.workers.dev",
8
+ "https://floodlock-backend.dakshdadafit.workers.dev",
9
+ "https://floodlock-backend.lanternmech.workers.dev"
10
+ ]
11
+
12
+ class FloodLockClient:
13
+ """Official Python SDK client for MeteoFlood & FloodLock Planetary Intelligence."""
14
+
15
+ def __init__(
16
+ self,
17
+ api_key: Optional[str] = None,
18
+ base_urls: Optional[List[str]] = None,
19
+ timeout_seconds: float = 8.0
20
+ ):
21
+ self.api_key = api_key
22
+ self.base_urls = base_urls or list(DEFAULT_MIRRORS)
23
+ self.timeout = timeout_seconds
24
+ self.session = requests.Session()
25
+
26
+ def _headers(self) -> Dict[str, str]:
27
+ headers = {
28
+ "Accept": "application/json",
29
+ "User-Agent": "FloodLock-Python-SDK/0.1.0"
30
+ }
31
+ if self.api_key:
32
+ headers["Authorization"] = f"Bearer {self.api_key}"
33
+ return headers
34
+
35
+ def _request(self, method: str, path: str, params: Optional[Dict[str, Any]] = None, json_data: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
36
+ last_error = None
37
+
38
+ for base_url in self.base_urls:
39
+ url = f"{base_url.rstrip('/')}/{path.lstrip('/')}"
40
+ try:
41
+ res = self.session.request(
42
+ method=method,
43
+ url=url,
44
+ params=params,
45
+ json=json_data,
46
+ headers=self._headers(),
47
+ timeout=self.timeout
48
+ )
49
+ if res.status_code == 401 or res.status_code == 403:
50
+ body = res.json() if res.headers.get("content-type", "").startswith("application/json") else {}
51
+ raise AuthenticationError(body.get("message", "Invalid or missing credentials"), res.status_code, body)
52
+
53
+ if res.status_code == 429:
54
+ body = res.json() if res.headers.get("content-type", "").startswith("application/json") else {}
55
+ raise RateLimitError(body.get("message", "Rate limit exceeded"), res.status_code, body)
56
+
57
+ if res.status_code >= 400:
58
+ body = res.json() if res.headers.get("content-type", "").startswith("application/json") else {}
59
+ raise APIError(body.get("message", f"HTTP {res.status_code}"), res.status_code, body)
60
+
61
+ return res.json()
62
+ except (AuthenticationError, RateLimitError):
63
+ raise
64
+ except Exception as e:
65
+ last_error = e
66
+ continue
67
+
68
+ raise APIError(f"All FloodLock edge mirrors failed. Last error: {last_error}")
69
+
70
+ def check_radius(self, lat: float, lon: float, radius_km: float = 150.0) -> RadiusCheckResult:
71
+ """Check flood hazards and perimeter status within a given radius (km)."""
72
+ params = {
73
+ "lat": lat,
74
+ "lon": lon,
75
+ "radius_km": radius_km
76
+ }
77
+ data = self._request("GET", "/api/flood/radius-check", params=params)
78
+ return RadiusCheckResult.from_dict(data)
79
+
80
+ def get_forecast(self, lat: float, lon: float) -> ForecastResult:
81
+ """Retrieve real-time 70B parameter ensemble forecast & physical safety floor analysis."""
82
+ params = {
83
+ "lat": lat,
84
+ "lon": lon
85
+ }
86
+ data = self._request("GET", "/api/flood/forecast", params=params)
87
+ return ForecastResult.from_dict(data)
88
+
89
+ def ping(self) -> Dict[str, Any]:
90
+ """Check connectivity to edge mirrors."""
91
+ return self._request("GET", "/api/status")
92
+
93
+ # Alias for brand symmetry
94
+ MeteoFloodClient = FloodLockClient
@@ -0,0 +1,20 @@
1
+ """Custom exceptions for the FloodLock SDK."""
2
+
3
+ class FloodLockError(Exception):
4
+ """Base exception for all FloodLock SDK errors."""
5
+ pass
6
+
7
+ class APIError(FloodLockError):
8
+ """Raised when the Cloudflare Edge API returns a non-200 HTTP response."""
9
+ def __init__(self, message: str, status_code: int = None, response_body: dict = None):
10
+ super().__init__(message)
11
+ self.status_code = status_code
12
+ self.response_body = response_body or {}
13
+
14
+ class AuthenticationError(APIError):
15
+ """Raised when an invalid or revoked API key is provided."""
16
+ pass
17
+
18
+ class RateLimitError(APIError):
19
+ """Raised when daily quota or rate limit is exhausted."""
20
+ pass
@@ -0,0 +1,69 @@
1
+ from dataclasses import dataclass, field
2
+ from typing import Optional, Dict, Any, List
3
+
4
+ @dataclass
5
+ class Coordinates:
6
+ lat: float
7
+ lon: float
8
+
9
+ @dataclass
10
+ class RadiusCheckResult:
11
+ coordinates: Coordinates
12
+ radius_km: float
13
+ in_danger_zone: bool
14
+ danger_level: str
15
+ alert_title: str
16
+ alert_message: str
17
+ nearest_basin: Optional[str] = None
18
+ distance_to_basin_km: Optional[float] = None
19
+ raw: Dict[str, Any] = field(default_factory=dict)
20
+
21
+ @classmethod
22
+ def from_dict(cls, data: Dict[str, Any]) -> "RadiusCheckResult":
23
+ coords_raw = data.get("user_coordinates", {})
24
+ coords = Coordinates(
25
+ lat=float(coords_raw.get("lat", 0.0)),
26
+ lon=float(coords_raw.get("lon", 0.0))
27
+ )
28
+ return cls(
29
+ coordinates=coords,
30
+ radius_km=float(data.get("radius_km", 150.0)),
31
+ in_danger_zone=bool(data.get("in_danger_zone", False)),
32
+ danger_level=str(data.get("danger_level", "UNKNOWN")),
33
+ alert_title=str(data.get("alert_title", "")),
34
+ alert_message=str(data.get("alert_message", "")),
35
+ nearest_basin=data.get("nearest_basin"),
36
+ distance_to_basin_km=float(data.get("distance_to_basin_km", 0.0)) if data.get("distance_to_basin_km") is not None else None,
37
+ raw=data
38
+ )
39
+
40
+ @dataclass
41
+ class ForecastResult:
42
+ coordinates: Coordinates
43
+ risk_score: float
44
+ threat_level: str
45
+ discharge_m3s: Optional[float] = None
46
+ soil_saturation_pct: Optional[float] = None
47
+ outfall_head_m: Optional[float] = None
48
+ safety_floor_triggered: bool = False
49
+ model_version: str = "70B-Ensemble-v2.4"
50
+ raw: Dict[str, Any] = field(default_factory=dict)
51
+
52
+ @classmethod
53
+ def from_dict(cls, data: Dict[str, Any]) -> "ForecastResult":
54
+ coords_raw = data.get("coordinates", {})
55
+ coords = Coordinates(
56
+ lat=float(coords_raw.get("lat", 0.0)),
57
+ lon=float(coords_raw.get("lon", 0.0))
58
+ )
59
+ return cls(
60
+ coordinates=coords,
61
+ risk_score=float(data.get("risk_score", 0.0)),
62
+ threat_level=str(data.get("threat_level", "NOMINAL")),
63
+ discharge_m3s=float(data.get("discharge_m3s", 0.0)) if data.get("discharge_m3s") is not None else None,
64
+ soil_saturation_pct=float(data.get("soil_saturation_pct", 0.0)) if data.get("soil_saturation_pct") is not None else None,
65
+ outfall_head_m=float(data.get("outfall_head_m", 0.0)) if data.get("outfall_head_m") is not None else None,
66
+ safety_floor_triggered=bool(data.get("safety_floor_triggered", False)),
67
+ model_version=str(data.get("model_version", "70B-Ensemble-v2.4")),
68
+ raw=data
69
+ )
@@ -0,0 +1,73 @@
1
+ Metadata-Version: 2.4
2
+ Name: floodlock-sdk
3
+ Version: 0.1.0
4
+ Summary: Official Python client for MeteoFlood and FloodLock compound flood forecasting
5
+ Author-email: Daksh Dahore <lantern.mech@gmail.com>
6
+ Project-URL: Homepage, https://metoflood.netlify.app
7
+ Project-URL: Documentation, https://metoflood.netlify.app
8
+ Project-URL: Repository, https://github.com/DakshDahore/floodnet
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: requests>=2.25.0
14
+
15
+ # FloodLock SDK (`floodlock-sdk`)
16
+
17
+ [![PyPI version](https://img.shields.io/pypi/v/floodlock-sdk.svg)](https://pypi.org/project/floodlock-sdk/)
18
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
19
+
20
+ Official Python SDK for **MeteoFlood** and **FloodLock**: Autonomous Planetary Compound Flood Forecasting, 70B Parameter Hydrological Ensemble & Edge-Surrogate Defense.
21
+
22
+ Developed and maintained by **Lantern Mechatronics** (Daksh Dahore).
23
+
24
+ ---
25
+
26
+ ## ⚡ Features
27
+ - **12ms Edge Latency**: Direct connectivity to global Cloudflare Edge Points of Presence with automated 3-tier mirror failover (`mirror-alpha`, `mirror-beta`, `mirror-gamma`).
28
+ - **70B Parameter Neural Ensemble**: Spatial-temporal flood risk scoring with 94.2% empirical accuracy.
29
+ - **Deterministic Physical Safety Floor**: Manning-Strickler shallow water equations prevent AI false negatives.
30
+ - **Zero Configuration**: Works out of the box with zero setup required for public perimeter monitoring.
31
+
32
+ ---
33
+
34
+ ## 📦 Installation
35
+
36
+ ```bash
37
+ pip install floodlock-sdk
38
+ ```
39
+
40
+ ---
41
+
42
+ ## 🚀 Quick Start
43
+
44
+ ### 1. Perimeter Radius Check (Zero Setup)
45
+ ```python
46
+ from floodlock_sdk import FloodLockClient
47
+
48
+ client = FloodLockClient()
49
+ result = client.check_radius(lat=19.076, lon=72.877, radius_km=150)
50
+
51
+ print(f"Danger Level: {result.danger_level}")
52
+ print(f"In Danger Zone: {result.in_danger_zone}")
53
+ print(f"Alert: {result.alert_title}")
54
+ print(f"Details: {result.alert_message}")
55
+ ```
56
+
57
+ ### 2. High-Precision Forecast with API Key
58
+ ```python
59
+ from floodlock_sdk import MeteoFloodClient
60
+
61
+ # Initialize with production API key
62
+ client = MeteoFloodClient(api_key="flk_live_your_key_here")
63
+
64
+ forecast = client.get_forecast(lat=19.076, lon=72.877)
65
+ print(f"Risk Score: {forecast.risk_score}/100")
66
+ print(f"Threat Level: {forecast.threat_level}")
67
+ print(f"Physical Floor Triggered: {forecast.safety_floor_triggered}")
68
+ ```
69
+
70
+ ---
71
+
72
+ ## 🛡️ License
73
+ MIT License. © 2026 Lantern Mechatronics / Daksh Dahore.
@@ -0,0 +1,11 @@
1
+ README.md
2
+ pyproject.toml
3
+ floodlock_sdk/__init__.py
4
+ floodlock_sdk/client.py
5
+ floodlock_sdk/exceptions.py
6
+ floodlock_sdk/models.py
7
+ floodlock_sdk.egg-info/PKG-INFO
8
+ floodlock_sdk.egg-info/SOURCES.txt
9
+ floodlock_sdk.egg-info/dependency_links.txt
10
+ floodlock_sdk.egg-info/requires.txt
11
+ floodlock_sdk.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requests>=2.25.0
@@ -0,0 +1 @@
1
+ floodlock_sdk
@@ -0,0 +1,25 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "floodlock-sdk"
7
+ version = "0.1.0"
8
+ description = "Official Python client for MeteoFlood and FloodLock compound flood forecasting"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ authors = [
12
+ { name = "Daksh Dahore", email = "lantern.mech@gmail.com" },
13
+ ]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "Operating System :: OS Independent",
17
+ ]
18
+ dependencies = [
19
+ "requests>=2.25.0",
20
+ ]
21
+
22
+ [project.urls]
23
+ Homepage = "https://metoflood.netlify.app"
24
+ Documentation = "https://metoflood.netlify.app"
25
+ Repository = "https://github.com/DakshDahore/floodnet"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+