[Deluge] #3271: Support pygeoip for ip lookups

2 views
Skip to first unread message

Deluge

unread,
Jun 17, 2019, 10:29:21 AM6/17/19
to delug...@googlegroups.com
#3271: Support pygeoip for ip lookups
-------------------+-------------------
Reporter: Cas | Owner:
Type: bug | Status: new
Priority: minor | Milestone: 2.0.4
Component: Core | Version: 2.0.0
Keywords: |
-------------------+-------------------
Alpine linux only packages the pure-python
[https://pypi.org/project/pygeoip/ pygeoip] as `py3-geoip` which is not
the same as the [https://pypi.org/project/GeoIP/ MaxMind GeoIP]
(`python3-geoip` on Ubuntu).

However they packages are compatible with some minor changes:

{{{#!diff
diff --git deluge/core/preferencesmanager.py
deluge/core/preferencesmanager.py
index e3c935c99..19dd3b2fb 100644
--- deluge/core/preferencesmanager.py
+++ deluge/core/preferencesmanager.py
@@ -24,10 +24,15 @@
from deluge._libtorrent import lt
from deluge.event import ConfigValueChangedEvent

+GeoIP = None
try:
- import GeoIP
+ from GeoIP import GeoIP
except ImportError:
- GeoIP = None
+ try:
+ from pygeoip import GeoIP
+ except:
+ ImportError:
+ pass

try:
from urllib.parse import quote_plus
@@ -464,9 +469,7 @@ def _on_set_geoip_db_location(self, key,
geoipdb_path):
# Load the GeoIP DB for country look-ups if available
if os.path.exists(geoipdb_path):
try:
- self.core.geoip_instance = GeoIP.open(
- geoipdb_path, GeoIP.GEOIP_STANDARD
- )
+ self.core.geoip_instance = GeoIP(geoipdb_path, 0)
except AttributeError:
log.warning('GeoIP Unavailable')
else:
}}}

--
Ticket URL: <https://dev.deluge-torrent.org/ticket/3271>
Deluge <https://deluge-torrent.org/>
Deluge Project

Deluge

unread,
Jun 18, 2019, 4:28:55 AM6/18/19
to delug...@googlegroups.com
#3271: Support pygeoip for ip lookups
--------------------+-------------------

Reporter: Cas | Owner:
Type: bug | Status: new
Priority: minor | Milestone: 2.0.4
Component: Core | Version: 2.0.0
Resolution: | Keywords:
--------------------+-------------------
Description changed by Cas:

Old description:

New description:

Alpine linux only packages the pure-python
[https://pypi.org/project/pygeoip/ pygeoip] as `py3-geoip` which is not
the same as the [https://pypi.org/project/GeoIP/ MaxMind GeoIP]
(`python3-geoip` on Ubuntu).

However they packages are compatible with some minor changes:

{{{#!diff
diff --git deluge/core/preferencesmanager.py
deluge/core/preferencesmanager.py
index e3c935c99..19dd3b2fb 100644
--- deluge/core/preferencesmanager.py
+++ deluge/core/preferencesmanager.py
@@ -24,10 +24,15 @@
from deluge._libtorrent import lt
from deluge.event import ConfigValueChangedEvent

+GeoIP = None
try:
- import GeoIP
+ from GeoIP import GeoIP
except ImportError:
- GeoIP = None
+ try:
+ from pygeoip import GeoIP

+ except ImportError:
+ pass

try:
from urllib.parse import quote_plus
@@ -464,9 +469,7 @@ def _on_set_geoip_db_location(self, key,
geoipdb_path):
# Load the GeoIP DB for country look-ups if available
if os.path.exists(geoipdb_path):
try:
- self.core.geoip_instance = GeoIP.open(
- geoipdb_path, GeoIP.GEOIP_STANDARD
- )
+ self.core.geoip_instance = GeoIP(geoipdb_path, 0)
except AttributeError:
log.warning('GeoIP Unavailable')
else:
}}}

--

--
Ticket URL: <https://dev.deluge-torrent.org/ticket/3271#comment:1>

Deluge

unread,
Jan 21, 2022, 5:43:00 AM1/21/22
to delug...@googlegroups.com
#3271: Support pygeoip for ip lookups
--------------------+--------------------
Reporter: Cas | Owner:
Type: bug | Status: closed
Priority: minor | Milestone: 2.0.6
Component: Core | Version: 2.0.0
Resolution: Fixed | Keywords:
--------------------+--------------------
Changes (by Cas):

* status: new => closed
* resolution: => Fixed


Comment:

Fixed by: [65e5010e7fbd]

--
Ticket URL: <https://dev.deluge-torrent.org/ticket/3271#comment:4>

Reply all
Reply to author
Forward
0 new messages