mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Add some more IP address info
This commit is contained in:
parent
951167ce17
commit
3dc29144a3
4 changed files with 26 additions and 11 deletions
7
API.md
7
API.md
|
@ -334,12 +334,15 @@ Optional parameters:
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
json:
|
json:
|
||||||
{"country": "United States",
|
{"continent": "North America",
|
||||||
|
"country": "United States",
|
||||||
"region": "California",
|
"region": "California",
|
||||||
"city": "Mountain View",
|
"city": "Mountain View",
|
||||||
|
"postal_code": "94035",
|
||||||
"timezone": "America/Los_Angeles",
|
"timezone": "America/Los_Angeles",
|
||||||
"latitude": 37.386,
|
"latitude": 37.386,
|
||||||
"longitude": -122.0838
|
"longitude": -122.0838,
|
||||||
|
"accuracy": 1000
|
||||||
}
|
}
|
||||||
json:
|
json:
|
||||||
{"error": "The address 127.0.0.1 is not in the database."
|
{"error": "The address 127.0.0.1 is not in the database."
|
||||||
|
|
|
@ -19,16 +19,19 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
|
<li>Continent: <strong><span id="continent"></span></strong></li>
|
||||||
<li>Country: <strong><span id="country"></span></strong></li>
|
<li>Country: <strong><span id="country"></span></strong></li>
|
||||||
<li>Region: <strong><span id="region"></span></strong></li>
|
<li>Region: <strong><span id="region"></span></strong></li>
|
||||||
<li>City: <strong><span id="city"></span></strong></li>
|
<li>City: <strong><span id="city"></span></strong></li>
|
||||||
|
<li>Postal Cide: <strong><span id="postal_code"></span></strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li>Timezone: <strong><span id="timezone"></span></strong></li>
|
<li>Timezone: <strong><span id="timezone"></span></strong></li>
|
||||||
<li>Latitude: <strong><span id="lat"></span></strong></li>
|
<li>Latitude: <strong><span id="latitude"></span></strong></li>
|
||||||
<li>Longitude: <strong><span id="lon"></span></strong></li>
|
<li>Longitude: <strong><span id="longitude"></span></strong></li>
|
||||||
|
<li>Accuracy Radius: <strong><span id="accuracy"></span></strong></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -55,12 +58,15 @@
|
||||||
if ('error' in data) {
|
if ('error' in data) {
|
||||||
$('#ip_error').html('<i class="fa fa-exclamation-circle"></i> ' + data.error + '<br /><br />').show();
|
$('#ip_error').html('<i class="fa fa-exclamation-circle"></i> ' + data.error + '<br /><br />').show();
|
||||||
} else {
|
} else {
|
||||||
|
$('#continent').html(data.continent);
|
||||||
$('#country').html(data.country);
|
$('#country').html(data.country);
|
||||||
$('#city').html(data.city);
|
|
||||||
$('#region').html(data.region);
|
$('#region').html(data.region);
|
||||||
|
$('#city').html(data.city);
|
||||||
|
$('#postal_code').html(data.postal_code);
|
||||||
$('#timezone').html(data.timezone);
|
$('#timezone').html(data.timezone);
|
||||||
$('#lat').html(data.latitude);
|
$('#latitude').html(data.latitude);
|
||||||
$('#lon').html(data.longitude);
|
$('#longitude').html(data.longitude);
|
||||||
|
$('#accuracy').html(data.accuracy + ' km');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -601,12 +601,15 @@ def geoip_lookup(ip_address):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return 'Error: %s' % e
|
return 'Error: %s' % e
|
||||||
|
|
||||||
geo_info = {'country': geo.country.name,
|
geo_info = {'continent': geo.continent.name,
|
||||||
|
'country': geo.country.name,
|
||||||
'region': geo.subdivisions.most_specific.name,
|
'region': geo.subdivisions.most_specific.name,
|
||||||
'city': geo.city.name,
|
'city': geo.city.name,
|
||||||
|
'postal_code': geo.postal.code,
|
||||||
'timezone': geo.location.time_zone,
|
'timezone': geo.location.time_zone,
|
||||||
'latitude': geo.location.latitude,
|
'latitude': geo.location.latitude,
|
||||||
'longitude': geo.location.longitude
|
'longitude': geo.location.longitude,
|
||||||
|
'accuracy': geo.location.accuracy_radius
|
||||||
}
|
}
|
||||||
|
|
||||||
return geo_info
|
return geo_info
|
||||||
|
|
|
@ -4278,12 +4278,15 @@ class WebInterface(object):
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
json:
|
json:
|
||||||
{"country": "United States",
|
{"continent": "North America",
|
||||||
|
"country": "United States",
|
||||||
"region": "California",
|
"region": "California",
|
||||||
"city": "Mountain View",
|
"city": "Mountain View",
|
||||||
|
"postal_code": "94035",
|
||||||
"timezone": "America/Los_Angeles",
|
"timezone": "America/Los_Angeles",
|
||||||
"latitude": 37.386,
|
"latitude": 37.386,
|
||||||
"longitude": -122.0838
|
"longitude": -122.0838,
|
||||||
|
"accuracy": 1000
|
||||||
}
|
}
|
||||||
json:
|
json:
|
||||||
{"error": "The address 127.0.0.1 is not in the database."
|
{"error": "The address 127.0.0.1 is not in the database."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue