Ottomata has submitted this change and it was merged.
Change subject: Switch to MaxMind's GeoIP API
......................................................................
Switch to MaxMind's GeoIP API
Use MaxMind's GeoIP C bindings instead of the pure Python geoip. The
former should perform better and is way more popular anyway.
Change-Id: Iccf3d804d6cc291dd511361bdc1f65327fae9e21
Note: this is completely UNTESTED.
---
M geowiki/geo_coding.py
M readme.md
M setup.py
3 files changed, 4 insertions(+), 5 deletions(-)
Approvals:
Ottomata: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/geowiki/geo_coding.py b/geowiki/geo_coding.py
index 55e5091..c58ed46 100644
--- a/geowiki/geo_coding.py
+++ b/geowiki/geo_coding.py
@@ -16,7 +16,7 @@
import pprint
from collections import defaultdict
-import pygeoip
+import GeoIP
logger = logging.getLogger(__name__)
@@ -41,8 +41,7 @@
:returns: (editors,cities)
'''
logger.debug('entering, geoIP_db: %s' % (geoIP_db))
- gi = pygeoip.GeoIP(geoIP_db, pygeoip.const.MEMORY_CACHE)
- #gi = pygeoip.GeoIP(geoIP_db)
+ gi = GeoIP.open(geoIP_db, GeoIP.GEOIP_MEMORY_CACHE)
logger.debug('loaded cache')
# test
diff --git a/readme.md b/readme.md
index 5b84c9d..a7277cb 100644
--- a/readme.md
+++ b/readme.md
@@ -22,7 +22,7 @@
* argparse
* [mySQLdb](http://mysql-python.sourceforge.net/)
* [mysql_config](http://dev.mysql.com/doc/refman/5.0/en/mysql-config.html)
-* [pygeoip](https://github.com/appliedsec/pygeoip), API for Maxmind GeoIP
databases. Note: `pip install pygeoip` install a non-functioning version,
instead `git clone` the repository and run `python setup.py install`.
+* [geoip](https://github.com/maxmind/geoip-api-python)
* [GeoIP City Database](http://www.maxmind.com/app/city) from Mindmind
## Configuration
diff --git a/setup.py b/setup.py
index 8cb69aa..a58cf76 100644
--- a/setup.py
+++ b/setup.py
@@ -22,7 +22,7 @@
install_requires = [
"argparse >=1.2.1",
"MySQL-python >= 1.2.3",
- "pygeoip >= 0.2.3",
+ "geoip",
"gcat == 0.1.0",
],
entry_points = {
--
To view, visit https://gerrit.wikimedia.org/r/75878
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iccf3d804d6cc291dd511361bdc1f65327fae9e21
Gerrit-PatchSet: 1
Gerrit-Project: analytics/editor-geocoding
Gerrit-Branch: master
Gerrit-Owner: Faidon <[email protected]>
Gerrit-Reviewer: Ottomata <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits