Spaces:
Running
on
T4
Running
on
T4
updating logs
Browse files- auditqa/utils.py +10 -9
auditqa/utils.py
CHANGED
|
@@ -154,19 +154,20 @@ def get_client_location(ip_address) -> dict | None:
|
|
| 154 |
if response.status_code == 200:
|
| 155 |
data = response.json()
|
| 156 |
# Add random noise between -0.01 and 0.01 degrees (roughly ±1km)
|
| 157 |
-
lat = data.get('latitude')
|
| 158 |
-
lon = data.get('longitude')
|
| 159 |
-
if lat is not None and lon is not None:
|
| 160 |
-
|
| 161 |
-
|
| 162 |
|
| 163 |
return {
|
| 164 |
'city': data.get('city'),
|
| 165 |
'region': data.get('region'),
|
| 166 |
-
'country': data.get('country_name')
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
|
|
|
| 170 |
elif response.status_code == 429:
|
| 171 |
logging.warning(f"Rate limit exceeded. Response: {response.text}")
|
| 172 |
return None
|
|
|
|
| 154 |
if response.status_code == 200:
|
| 155 |
data = response.json()
|
| 156 |
# Add random noise between -0.01 and 0.01 degrees (roughly ±1km)
|
| 157 |
+
#lat = data.get('latitude')
|
| 158 |
+
#lon = data.get('longitude')
|
| 159 |
+
#if lat is not None and lon is not None:
|
| 160 |
+
# lat += random.uniform(-0.01, 0.01)
|
| 161 |
+
# lon += random.uniform(-0.01, 0.01)
|
| 162 |
|
| 163 |
return {
|
| 164 |
'city': data.get('city'),
|
| 165 |
'region': data.get('region'),
|
| 166 |
+
'country': data.get('country_name')}
|
| 167 |
+
#,
|
| 168 |
+
# 'latitude': lat,
|
| 169 |
+
# 'longitude': lon
|
| 170 |
+
#}
|
| 171 |
elif response.status_code == 429:
|
| 172 |
logging.warning(f"Rate limit exceeded. Response: {response.text}")
|
| 173 |
return None
|