Spaces:
Running
Running
Commit
·
0d5968d
1
Parent(s):
9dd9279
Update main.py
Browse files
main.py
CHANGED
@@ -46,6 +46,13 @@ def get_location(ip):
|
|
46 |
'region': location['subdivisions'][0]['names']['en'] if 'subdivisions' in location else 'unknown region',
|
47 |
'loc': str(location['location']['latitude']) + ',' + str(location['location']['longitude']),
|
48 |
'timezone': location['location']['time_zone'] if 'time_zone' in location['location'] else 'America/New_York'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
def latlon_to_pixel(loc):
|
51 |
latitude = float(loc.split(',')[0])
|
|
|
46 |
'region': location['subdivisions'][0]['names']['en'] if 'subdivisions' in location else 'unknown region',
|
47 |
'loc': str(location['location']['latitude']) + ',' + str(location['location']['longitude']),
|
48 |
'timezone': location['location']['time_zone'] if 'time_zone' in location['location'] else 'America/New_York'}
|
49 |
+
else:
|
50 |
+
return {'country': 'unknown country',
|
51 |
+
'city': 'unknown city',
|
52 |
+
'region': 'unknown region',
|
53 |
+
'loc': str(0) + ',' + str(0),
|
54 |
+
'timezone':'America/New_York'}
|
55 |
+
|
56 |
|
57 |
def latlon_to_pixel(loc):
|
58 |
latitude = float(loc.split(',')[0])
|