mirror of
https://github.com/oddluck/limnoria-plugins.git
synced 2025-04-25 12:31:07 -05:00
Geo: add licenseKey config.
This commit is contained in:
parent
dfce5a9b81
commit
9a7f3f9b0c
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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
1
Geo/requirements.txt
Normal file
@ -0,0 +1 @@
|
||||
geoip2
|
Loading…
x
Reference in New Issue
Block a user