Skip to content

Commit

Permalink
Merge pull request #92 from maxmind/greg/geoip-4.5.0
Browse files Browse the repository at this point in the history
Upgrade geoip2 to 4.5.0
  • Loading branch information
horgh authored Nov 18, 2021
2 parents bf93da6 + 0e97982 commit e0852b0
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: "3.10"

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
# We don't test on Windows currently as it appears mocket may not
# work there.
platform: [ubuntu-latest, macos-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]

name: Python ${{ matrix.python-version }} on ${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
Expand Down
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ History
2.6.0
++++++++++++++++++

* Upgraded ``geoip2`` to 4.5.0. This adds mobile country code (MCC) and mobile
network code (MNC) to minFraud Insights and Factors responses. These are
available at ``response.ip_address.traits.mobile_country_code`` and
``response.ip_address.traits.mobile_network_code``. We expect this data to be
available by late January, 2022.
* Added the following new values to the ``/payment/processor`` validation:
* ``boacompra``
* ``boku``
Expand Down
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ max-line-length = 88
universal = 1

[tox:tox]
envlist = py36, py37, py38, py39, mypy
envlist = py36, py37, py38, py39, py310, mypy

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39, mypy
3.9: py39
"3.10": py310, mypy

[testenv]
deps =
Expand Down
8 changes: 1 addition & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,12 @@
requirements = [
"aiohttp>=3.6.2,<4.0.0",
"email_validator>=1.1.1,<2.0.0",
"geoip2>=4.3.0,<5.0.0",
"geoip2>=4.5.0,<5.0.0",
"requests>=2.24.0,<3.0.0",
"urllib3>=1.25.2,<2.0.0",
"voluptuous",
]

# Write requirements.txt needed for snyk testing, only for latest release python.
if os.environ.get("SNYK_TOKEN") and os.environ.get("RUN_SNYK"):
with open("requirements.txt", "w") as f:
for r in requirements:
f.write(r + "\n")

setup(
name="minfraud",
version=_version,
Expand Down
2 changes: 2 additions & 0 deletions tests/data/factors-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"is_satellite_provider": true,
"is_tor_exit_node": true,
"isp": "Andrews & Arnold Ltd",
"mobile_country_code" : "310",
"mobile_network_code" : "004",
"organization": "STONEHOUSE office network",
"user_type": "government"
}
Expand Down
2 changes: 2 additions & 0 deletions tests/data/insights-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
"is_satellite_provider": true,
"is_tor_exit_node": true,
"isp": "Andrews & Arnold Ltd",
"mobile_country_code" : "310",
"mobile_network_code" : "004",
"organization": "STONEHOUSE office network",
"user_type": "government"
}
Expand Down
4 changes: 4 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ def test_ip_address(self):
"is_residential_proxy": True,
"is_satellite_provider": True,
"is_tor_exit_node": True,
"mobile_country_code": "310",
"mobile_network_code": "004",
},
}
)
Expand All @@ -191,6 +193,8 @@ def test_ip_address(self):
self.assertEqual(True, address.traits.is_residential_proxy)
self.assertEqual(True, address.traits.is_satellite_provider)
self.assertEqual(True, address.traits.is_tor_exit_node)
self.assertEqual("310", address.traits.mobile_country_code)
self.assertEqual("004", address.traits.mobile_network_code)
self.assertEqual(True, address.country.is_high_risk)

self.assertEqual("ANONYMOUS_IP", address.risk_reasons[0].code)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_webservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ def test_200(self):
if self.has_ip_location():
self.assertEqual("United Kingdom", model.ip_address.country.name)
self.assertEqual(True, model.ip_address.traits.is_residential_proxy)
self.assertEqual("310", model.ip_address.traits.mobile_country_code)
self.assertEqual("004", model.ip_address.traits.mobile_network_code)
self.assertEqual("ANONYMOUS_IP", model.ip_address.risk_reasons[0].code)

@httprettified
Expand Down

0 comments on commit e0852b0

Please sign in to comment.