Update app.py
Browse files
app.py
CHANGED
@@ -13,16 +13,20 @@ async def get_location(request: Request):
|
|
13 |
"""
|
14 |
# Obtendo o IP do cliente
|
15 |
client_host = request.client.host
|
16 |
-
|
17 |
# Consultando informações de localização
|
18 |
details = handler.getDetails(client_host)
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
"
|
26 |
-
"
|
|
|
|
|
|
|
|
|
|
|
27 |
}
|
28 |
-
return location_data
|
|
|
13 |
"""
|
14 |
# Obtendo o IP do cliente
|
15 |
client_host = request.client.host
|
16 |
+
|
17 |
# Consultando informações de localização
|
18 |
details = handler.getDetails(client_host)
|
19 |
+
|
20 |
+
# Extraindo informações disponíveis
|
21 |
+
location_data = details.all
|
22 |
+
|
23 |
+
# Retornando as informações como JSON
|
24 |
+
return {
|
25 |
+
"ip": location_data.get("ip", "Desconhecido"),
|
26 |
+
"city": location_data.get("city", "Desconhecida"),
|
27 |
+
"region": location_data.get("region", "Desconhecida"),
|
28 |
+
"country": location_data.get("country", "Desconhecido"),
|
29 |
+
"latitude": location_data.get("latitude", "Desconhecida"),
|
30 |
+
"longitude": location_data.get("longitude", "Desconhecida"),
|
31 |
+
"organization": location_data.get("org", "Desconhecida")
|
32 |
}
|
|