Spaces:
Running
Running
Commit
·
7637822
1
Parent(s):
d4b2db6
Update main.py
Browse files
main.py
CHANGED
@@ -42,7 +42,7 @@ def get_location(ip):
|
|
42 |
geolite2.close()
|
43 |
if location and 'location' in location:
|
44 |
return {'country': location['country']['names']['en'],
|
45 |
-
'city': location['city']['names']['en'] if 'city' in location,
|
46 |
'region': location['subdivisions'][0]['names']['en'] if len(location['subdivisions'])>0 else '',
|
47 |
'loc': str(location['location']['longitude']) + ',' + str(location['location']['latitude']),
|
48 |
'timezone': location['location']['time_zone']}
|
|
|
42 |
geolite2.close()
|
43 |
if location and 'location' in 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 len(location['subdivisions'])>0 else '',
|
47 |
'loc': str(location['location']['longitude']) + ',' + str(location['location']['latitude']),
|
48 |
'timezone': location['location']['time_zone']}
|