From 7e6a1d140eb3eb7a5e211e827e42a259e30af4dc Mon Sep 17 00:00:00 2001 From: Girish Date: Wed, 24 Mar 2021 18:26:22 +0000 Subject: [PATCH 1/2] Handling when raw_data is None - related to #51 * Handling when raw_data is None` * drop 2.7 support + making _raw_data to dict * updating pip in travis * updating tox * testing tox * update travis config * adding 3.9 support related to #51 --- .travis.yml | 10 ++++++++-- django_ip_geolocation/backends/base.py | 2 +- django_ip_geolocation/backends/ipdataco.py | 1 - tox.ini | 20 ++++++++++---------- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7e391bd..204e0a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,21 @@ language: python + python: - - "2.7" - "3.5" - "3.6" # current default Python on Travis CI - "3.7" - "3.8" + - "3.9" + +# updating pip +before_install: + - pip install --upgrade pip tox virtualenv + # command to install dependencies install: - pip install -r tests/requirements.txt -# command to run tests +# command to run tests script: - flake8 --count --statistics django_ip_geolocation - bandit -r django_ip_geolocation diff --git a/django_ip_geolocation/backends/base.py b/django_ip_geolocation/backends/base.py index 4eb3b01..131882a 100644 --- a/django_ip_geolocation/backends/base.py +++ b/django_ip_geolocation/backends/base.py @@ -14,7 +14,7 @@ def __init__(self, ip): self._continent = None self._country = None self._geo_data = None - self._raw_data = None + self._raw_data = {} def geolocate(self): """Call geoloaction api. Should be overriden.""" diff --git a/django_ip_geolocation/backends/ipdataco.py b/django_ip_geolocation/backends/ipdataco.py index 77e4138..0abb5af 100644 --- a/django_ip_geolocation/backends/ipdataco.py +++ b/django_ip_geolocation/backends/ipdataco.py @@ -28,7 +28,6 @@ def _parse(self): 'code': self._raw_data.get('country_code'), 'name': self._raw_data.get('country_name'), } - self._geo_data = { 'latitude': self._raw_data.get('latitude'), 'longitude': self._raw_data.get('longitude'), diff --git a/tox.ini b/tox.ini index c1d12a6..45da24e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,24 +1,24 @@ [tox] envlist = - {py27}-django-111 - {py35}-django-20 - {py36}-django-20 - {py37}-django-22 - {py38}-django-30 + {py35}-django-22 + {py36}-django-30 + {py37}-django-31 + {py38}-django-stable + {py39}-django-stable [testenv] setenv = PYTHONPATH = {toxinidir}:{toxinidir}/django_ip_geolocation commands = coverage run --source django_ip_geolocation manage.py test -v2 deps = - django-111: Django>=1.11,<1.12 - django-20: Django>=2.0,<2.1 - django-22: Django>=2.2 - django-30: Django>=3.0 + django-22: Django>=2.2,<2.3 + django-30: Django>=3.0,<3.1 + django-31: Django>=3.1,<3.2 + django-stable: git+https://github.com/django/django.git@stable/3.1.x#egg=Django -r{toxinidir}/tests/requirements.txt basepython = - py27: python2.7 py35: python3.5 py36: python3.6 py37: python3.7 py38: python3.8 + py39: python3.9 From 2cd80f5c4a176841166e4107036224e362f495dd Mon Sep 17 00:00:00 2001 From: SkanderBM Date: Thu, 25 Mar 2021 09:48:19 +0100 Subject: [PATCH 2/2] bump version 1.6.0 -> 1.6.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c6e9ada..788b3fe 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ def readme(): setup( name='django-ip-geolocation', - version='1.6.0', + version='1.6.1', author='Skander Ben Mahmoud', author_email='skander.bmahmoud@gmail.com', packages=find_packages(exclude=("*tests*", "docs")),