geo-engine-python 0.1.1__py3-none-any.whl → 0.1.3__py3-none-any.whl
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.
- geo_engine_python-0.1.3.dist-info/METADATA +122 -0
- geo_engine_python-0.1.3.dist-info/RECORD +5 -0
- {geo_engine_python-0.1.1.dist-info → geo_engine_python-0.1.3.dist-info}/WHEEL +1 -1
- geoengine/__init__.py +1 -0
- geo_engine_python-0.1.1.dist-info/METADATA +0 -13
- geo_engine_python-0.1.1.dist-info/RECORD +0 -5
- geoengine.py +0 -84
- {geo_engine_python-0.1.1.dist-info → geo_engine_python-0.1.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: geo-engine-python
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: SDK oficial para Geo-Engine: Rastreo y Geofencing
|
|
5
|
+
Home-page: https://github.com/AlexG695/geo-engine-python
|
|
6
|
+
Author: AlexG695
|
|
7
|
+
Author-email: AlexG <alexg@geoengine.dev>
|
|
8
|
+
Project-URL: Homepage, https://geoengine.dev
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/AlexG695/geo-engine/issues
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.7
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Requires-Dist: requests>=2.25.0
|
|
16
|
+
Dynamic: author
|
|
17
|
+
Dynamic: home-page
|
|
18
|
+
Dynamic: requires-python
|
|
19
|
+
|
|
20
|
+
# 🐍 Geo-Engine Python SDK
|
|
21
|
+
|
|
22
|
+
Cliente oficial en **Python** para interactuar con la plataforma **Geo-Engine**.
|
|
23
|
+
Permite enviar ubicaciones en tiempo real, gestionar geocercas y consumir la API de Geo-Engine desde aplicaciones **Django**, **Flask**, scripts o entornos de **Data Science**.
|
|
24
|
+
|
|
25
|
+
Diseñado para ser **simple**, **rápido** y **fácil de integrar**.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 🚀 Instalación
|
|
30
|
+
|
|
31
|
+
Instala el SDK usando `pip`:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install geo-engine-python
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## ⚡ Uso Rápido
|
|
40
|
+
|
|
41
|
+
Envía la ubicación de un dispositivo en pocos pasos:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from geo_engine import GeoEngine
|
|
45
|
+
|
|
46
|
+
# 1. Inicializar el cliente
|
|
47
|
+
# Por defecto se conecta al entorno de producción
|
|
48
|
+
client = GeoEngine(api_key="sk_live_123456")
|
|
49
|
+
|
|
50
|
+
# 2. Enviar ubicación
|
|
51
|
+
try:
|
|
52
|
+
res = client.send_location(
|
|
53
|
+
device_id="camion-01",
|
|
54
|
+
lat=19.4326,
|
|
55
|
+
lng=-99.1332
|
|
56
|
+
)
|
|
57
|
+
print(f"✅ Enviado: {res}")
|
|
58
|
+
except Exception as e:
|
|
59
|
+
print(f"❌ Error: {e}")
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## 🔧 Configuración Avanzada
|
|
65
|
+
|
|
66
|
+
Puedes personalizar la configuración para conectarte a otros entornos (por ejemplo, local o staging) o modificar URLs internas:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
client = GeoEngine(
|
|
70
|
+
api_key="sk_test_...",
|
|
71
|
+
ingest_url="http://localhost:8080",
|
|
72
|
+
management_url="http://localhost:8081"
|
|
73
|
+
)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 🧩 Casos de Uso Comunes
|
|
79
|
+
|
|
80
|
+
* 📍 **Tracking en tiempo real** de vehículos o dispositivos IoT
|
|
81
|
+
* 🚚 **Logística y última milla**
|
|
82
|
+
* 🗺️ **Geocercas** y eventos por entrada/salida
|
|
83
|
+
* 📊 **Análisis de datos geoespaciales** en notebooks o pipelines
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 🔐 Autenticación
|
|
88
|
+
|
|
89
|
+
El SDK utiliza **API Keys** para autenticarse.
|
|
90
|
+
Asegúrate de mantenerlas seguras y **no exponerlas en el frontend**.
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
GeoEngine(api_key="sk_live_...")
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 🧪 Compatibilidad
|
|
99
|
+
|
|
100
|
+
* Python **3.8+**
|
|
101
|
+
* Funciona con:
|
|
102
|
+
|
|
103
|
+
* Django
|
|
104
|
+
* Flask
|
|
105
|
+
* FastAPI
|
|
106
|
+
* Scripts CLI
|
|
107
|
+
* Jupyter / Data Science
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## 📄 Licencia
|
|
112
|
+
|
|
113
|
+
MIT © Geo-Engine
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 🤝 Soporte
|
|
118
|
+
|
|
119
|
+
¿Tienes dudas o sugerencias?
|
|
120
|
+
Abre un issue o contáctanos en **[support@geoengine.dev](mailto:support@geoengine.dev)**
|
|
121
|
+
|
|
122
|
+
---
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
geoengine/__init__.py,sha256=X_uLLSuqTVF6kJ1T66ms7krwwHNq9a6RzQitoya1yv8,45
|
|
2
|
+
geo_engine_python-0.1.3.dist-info/METADATA,sha256=i--yZU0q98c24YT9UFWj4nbJdIiPpsFLKRG-SR8OkWY,2697
|
|
3
|
+
geo_engine_python-0.1.3.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
|
|
4
|
+
geo_engine_python-0.1.3.dist-info/top_level.txt,sha256=bqE5zIDfI6saPEFHhCIwqCBOhsiQ998LGjP_srSIg9E,10
|
|
5
|
+
geo_engine_python-0.1.3.dist-info/RECORD,,
|
geoengine/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .client import GeoEngine, GeoEngineError
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: geo-engine-python
|
|
3
|
-
Version: 0.1.1
|
|
4
|
-
Summary: SDK oficial para Geo-Engine: Rastreo y Geofencing
|
|
5
|
-
Author-email: AlexG <alexg695845@gmail.com>
|
|
6
|
-
Project-URL: Homepage, https://app.geoengine.dev
|
|
7
|
-
Project-URL: Bug Tracker, https://github.com/AlexG695/geo-engine/issues
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Operating System :: OS Independent
|
|
11
|
-
Requires-Python: >=3.7
|
|
12
|
-
Description-Content-Type: text/markdown
|
|
13
|
-
Requires-Dist: requests>=2.25.0
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
geoengine.py,sha256=EvdP--5NJOFvjn-A0QVEqufzTSWIOhCnO_xWMLqopiE,2693
|
|
2
|
-
geo_engine_python-0.1.1.dist-info/METADATA,sha256=i9IuIgv_oBUqlH_NpM4u_GRyhb6WnFf0kB1fe8wle0Q,526
|
|
3
|
-
geo_engine_python-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
4
|
-
geo_engine_python-0.1.1.dist-info/top_level.txt,sha256=bqE5zIDfI6saPEFHhCIwqCBOhsiQ998LGjP_srSIg9E,10
|
|
5
|
-
geo_engine_python-0.1.1.dist-info/RECORD,,
|
geoengine.py
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import requests
|
|
2
|
-
import time
|
|
3
|
-
import json
|
|
4
|
-
|
|
5
|
-
class GeoEngine:
|
|
6
|
-
DEFAULT_MANAGEMENT_URL = "https://api.geoengine.dev"
|
|
7
|
-
DEFAULT_INGEST_URL = "https://ingest.geoengine.dev"
|
|
8
|
-
|
|
9
|
-
def __init__(self, api_key, management_url=None, ingest_url=None):
|
|
10
|
-
"""
|
|
11
|
-
Inicializa el cliente de GeoEngine.
|
|
12
|
-
"""
|
|
13
|
-
if not api_key:
|
|
14
|
-
raise ValueError("GeoEngine: API Key es requerida")
|
|
15
|
-
|
|
16
|
-
self.api_key = api_key
|
|
17
|
-
self.management_url = management_url or self.DEFAULT_MANAGEMENT_URL
|
|
18
|
-
self.ingest_url = ingest_url or self.DEFAULT_INGEST_URL
|
|
19
|
-
self.headers = {
|
|
20
|
-
"Content-Type": "application/json",
|
|
21
|
-
"X-API-Key": self.api_key,
|
|
22
|
-
"User-Agent": "GeoEnginePython/1.0.0"
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
def send_location(self, device_id, lat, lng):
|
|
26
|
-
"""
|
|
27
|
-
Envía una coordenada al motor de ingestión.
|
|
28
|
-
"""
|
|
29
|
-
payload = {
|
|
30
|
-
"device_id": device_id,
|
|
31
|
-
"latitude": float(lat),
|
|
32
|
-
"longitude": float(lng),
|
|
33
|
-
"timestamp": int(time.time())
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
try:
|
|
37
|
-
response = requests.post(
|
|
38
|
-
f"{self.ingest_url}/ingest",
|
|
39
|
-
json=payload,
|
|
40
|
-
headers=self.headers,
|
|
41
|
-
timeout=10
|
|
42
|
-
)
|
|
43
|
-
response.raise_for_status()
|
|
44
|
-
return response.json()
|
|
45
|
-
except requests.exceptions.RequestException as e:
|
|
46
|
-
raise Exception(f"GeoEngine Error: {e}")
|
|
47
|
-
|
|
48
|
-
def create_geofence(self, name, coordinates, webhook_url):
|
|
49
|
-
"""
|
|
50
|
-
Crea una geocerca.
|
|
51
|
-
coordinates debe ser una lista de listas: [[lat, lng], [lat, lng]]
|
|
52
|
-
"""
|
|
53
|
-
if len(coordinates) < 3:
|
|
54
|
-
raise ValueError("Se requieren al menos 3 puntos")
|
|
55
|
-
|
|
56
|
-
# Convertir [Lat, Lng] a [Lng, Lat] para GeoJSON
|
|
57
|
-
polygon = [[p[1], p[0]] for p in coordinates]
|
|
58
|
-
|
|
59
|
-
# Cerrar polígono
|
|
60
|
-
if polygon[0] != polygon[-1]:
|
|
61
|
-
polygon.append(polygon[0])
|
|
62
|
-
|
|
63
|
-
payload = {
|
|
64
|
-
"name": name,
|
|
65
|
-
"webhook_url": webhook_url,
|
|
66
|
-
"geojson": {
|
|
67
|
-
"type": "Polygon",
|
|
68
|
-
"coordinates": [polygon]
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
try:
|
|
73
|
-
response = requests.post(
|
|
74
|
-
f"{self.management_url}/geofences",
|
|
75
|
-
json=payload,
|
|
76
|
-
headers=self.headers,
|
|
77
|
-
timeout=10
|
|
78
|
-
)
|
|
79
|
-
response.raise_for_status()
|
|
80
|
-
return response.json()
|
|
81
|
-
except requests.exceptions.RequestException as e:
|
|
82
|
-
if response.content:
|
|
83
|
-
raise Exception(f"API Error: {response.json().get('error', response.text)}")
|
|
84
|
-
raise Exception(f"Connection Error: {e}")
|
|
File without changes
|