Update ips_to_maps.py

This commit is contained in:
blacktwin 2017-07-29 15:48:50 -04:00 committed by GitHub
parent 3fd41aaf4d
commit 738d45c881

View File

@ -187,11 +187,12 @@ def get_geo_dict(length, users):
geo_dict = {SERVER_FRIENDLY: [{'lon': SERVER_LON, 'lat': SERVER_LAT, 'city': SERVER_CITY, 'region': SERVER_STATE,
'ip': REPLACEMENT_WAN_IP, 'play_count': 0, 'platform': SERVER_PLATFORM,
'location_count': 0}]}
try:
for i in get_get_users_tables(users):
user_ip = get_get_users_ips(user_id=i, length=length)
city_cnt = 0
for a in user_ip:
try:
ip = a.ip_address
if ip.startswith(LAN_SUBNET) and REPLACEMENT_WAN_IP:
ip = REPLACEMENT_WAN_IP
@ -202,12 +203,11 @@ def get_geo_dict(length, users):
'city': str(g.city), 'region': str(g.region),
'ip': ip, 'play_count': a.play_count,
'platform':a.platform, 'location_count': city_cnt})
except AttributeError:
print('User: {} IP: {} caused error in geo_dict.'.format(a.friendly_name, a.ip_address))
pass
except Exception as e:
print(e)
print('Error here: {}'.format(e))
pass
return geo_dict