diff --git a/Geo/README.md b/Geo/README.md index f265e6d..b110abe 100644 --- a/Geo/README.md +++ b/Geo/README.md @@ -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 +``` + Usage: ``` geo (geolocate (must be in channel) , or address diff --git a/Geo/config.py b/Geo/config.py index 4d5fb2b..159accd 100644 --- a/Geo/config.py +++ b/Geo/config.py @@ -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: diff --git a/Geo/plugin.py b/Geo/plugin.py index 1a4a1f7..1bbd85f 100644 --- a/Geo/plugin.py +++ b/Geo/plugin.py @@ -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)) diff --git a/Geo/requirements.txt b/Geo/requirements.txt new file mode 100644 index 0000000..3df7f05 --- /dev/null +++ b/Geo/requirements.txt @@ -0,0 +1 @@ +geoip2