add a link to OSM map as a CapGeolocIp field and make the application fill it

This commit is contained in:
Julien Veyssier 2015-02-21 17:11:22 +01:00 committed by Romain Bignon
commit 00112b3e51
2 changed files with 3 additions and 0 deletions

View file

@ -40,4 +40,6 @@ class Geolooc(ReplApplication):
return 2
for location in self.do('get_location', argv[1]):
if location.lt and location.lg:
location.osmlink = u'http://www.openstreetmap.org/?mlat=%s&mlon=%s#map=13/%s/%s' % (location.lt, location.lg, location.lt, location.lg)
self.format(location)

View file

@ -34,6 +34,7 @@ class IpLocation(BaseObject):
country = StringField('Country')
lt = FloatField('Latitude')
lg = FloatField('Longitude')
osmlink = StringField('Link to OpenStreetMap location page')
host = StringField('Hostname')
tld = StringField('Top Level Domain')
isp = StringField('Internet Service Provider')