Geo: add licenseKey config.

This commit is contained in:
oddluck 2020-01-02 18:17:46 +00:00
parent dfce5a9b81
commit 9a7f3f9b0c
4 changed files with 19 additions and 1 deletions

View File

@ -6,6 +6,18 @@ Requires GeoIP2-python:
```
pip install geoip2
```
Requires a MaxMind license key to update the database.
```
Sign up for a MaxMind account at https://www.maxmind.com/en/geolite2/signup
```
```
Create a license key at https://www.maxmind.com/en/accounts/current/license-key
```
```
config plugins.geo.licenseKey <Your_Key_Here>
```
Usage:
```
geo <nick/host/ip> (geolocate <nick> (must be in channel) <host>, or <ip> address

View File

@ -22,4 +22,8 @@ Geo = conf.registerPlugin('Geo')
conf.registerGlobalValue(Geo, 'datalastupdated',
registry.PositiveInteger(1, """An integer representing the time since epoch the .dat file was last updated."""))
conf.registerGlobalValue(Geo, 'licenseKey',
registry.String('', """MaxMind license key."""))
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:

View File

@ -115,7 +115,8 @@ class Geo(callbacks.Plugin):
def getfile(self):
"""grabs the data file"""
u='https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz'
license = self.registryValue('licenseKey')
u='https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key={}&suffix=tar.gz'.format(license)
f = '%s%sgeo%sGeoLite2-City.tar.gz' % (conf.supybot.directories.data(), os.sep, os.sep)
f2 = '%s%sgeo%sGeoLite2-City.tar' % (conf.supybot.directories.data(), os.sep, os.sep)
self.make_sure_path_exists(r'%s%sgeo' % (conf.supybot.directories.data(),os.sep))

1
Geo/requirements.txt Normal file
View File

@ -0,0 +1 @@
geoip2