Spaces:
Running
Running
BraydenMoore
commited on
Commit
·
9dd9279
1
Parent(s):
3a05da9
Update main.py
Browse files
main.py
CHANGED
@@ -41,9 +41,9 @@ def get_location(ip):
|
|
41 |
location = reader.get(ip)
|
42 |
geolite2.close()
|
43 |
if location:
|
44 |
-
return {'country': location['country']['names']['en'],
|
45 |
-
'city': location['city']['names']['en'] if 'city' in location else '',
|
46 |
-
'region': location['subdivisions'][0]['names']['en'] if 'subdivisions' in location else '',
|
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 |
|
|
|
41 |
location = reader.get(ip)
|
42 |
geolite2.close()
|
43 |
if location:
|
44 |
+
return {'country': location['country']['names']['en'] if 'country' in location else 'unknown country',
|
45 |
+
'city': location['city']['names']['en'] if 'city' in location else 'unknown city',
|
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 |
|