mirror of
https://github.com/adulau/mmdb-server.git
synced 2024-11-07 11:36:24 +00:00
new: [mygeolookup] Query on root of the server will give the geo location of the remote IP address doing the query.
This commit is contained in:
parent
dd484f83a3
commit
eb37aa0cc9
1 changed files with 14 additions and 0 deletions
|
@ -62,6 +62,19 @@ class GeoLookup:
|
|||
georesult = q.get(value)
|
||||
ret.append(georesult)
|
||||
georesult['meta'] = meta
|
||||
georesult['ip'] = value
|
||||
resp.media = ret
|
||||
return
|
||||
|
||||
|
||||
class MyGeoLookup:
|
||||
def on_get(self, req, resp):
|
||||
ret = []
|
||||
ips = req.access_route
|
||||
georesult = q.get(ips[0])
|
||||
ret.append(georesult)
|
||||
georesult['meta'] = meta
|
||||
georesult['ip'] = ips[0]
|
||||
resp.media = ret
|
||||
return
|
||||
|
||||
|
@ -69,6 +82,7 @@ class GeoLookup:
|
|||
app = falcon.App()
|
||||
|
||||
app.add_route('/geolookup/{value}', GeoLookup())
|
||||
app.add_route('/', MyGeoLookup())
|
||||
|
||||
if __name__ == '__main__':
|
||||
with make_server('', 8000, app) as httpd:
|
||||
|
|
Loading…
Reference in a new issue