Skip to content

Commit e0852b0

Browse files
authored
Merge pull request #92 from maxmind/greg/geoip-4.5.0
Upgrade geoip2 to 4.5.0
2 parents bf93da6 + 0e97982 commit e0852b0

9 files changed

Lines changed: 21 additions & 11 deletions

File tree

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up Python
1818
uses: actions/setup-python@v2
1919
with:
20-
python-version: 3.9
20+
python-version: "3.10"
2121

2222
- name: Install dependencies
2323
run: |

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
# We don't test on Windows currently as it appears mocket may not
1515
# work there.
1616
platform: [ubuntu-latest, macos-latest]
17-
python-version: [3.6, 3.7, 3.8, 3.9]
17+
python-version: [3.6, 3.7, 3.8, 3.9, "3.10"]
1818

1919
name: Python ${{ matrix.python-version }} on ${{ matrix.platform }}
2020
runs-on: ${{ matrix.platform }}

HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ History
66
2.6.0
77
++++++++++++++++++
88

9+
* Upgraded ``geoip2`` to 4.5.0. This adds mobile country code (MCC) and mobile
10+
network code (MNC) to minFraud Insights and Factors responses. These are
11+
available at ``response.ip_address.traits.mobile_country_code`` and
12+
``response.ip_address.traits.mobile_network_code``. We expect this data to be
13+
available by late January, 2022.
914
* Added the following new values to the ``/payment/processor`` validation:
1015
* ``boacompra``
1116
* ``boku``

setup.cfg

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ max-line-length = 88
99
universal = 1
1010

1111
[tox:tox]
12-
envlist = py36, py37, py38, py39, mypy
12+
envlist = py36, py37, py38, py39, py310, mypy
1313

1414
[gh-actions]
1515
python =
1616
3.6: py36
1717
3.7: py37
1818
3.8: py38
19-
3.9: py39, mypy
19+
3.9: py39
20+
"3.10": py310, mypy
2021

2122
[testenv]
2223
deps =

setup.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,12 @@
1919
requirements = [
2020
"aiohttp>=3.6.2,<4.0.0",
2121
"email_validator>=1.1.1,<2.0.0",
22-
"geoip2>=4.3.0,<5.0.0",
22+
"geoip2>=4.5.0,<5.0.0",
2323
"requests>=2.24.0,<3.0.0",
2424
"urllib3>=1.25.2,<2.0.0",
2525
"voluptuous",
2626
]
2727

28-
# Write requirements.txt needed for snyk testing, only for latest release python.
29-
if os.environ.get("SNYK_TOKEN") and os.environ.get("RUN_SNYK"):
30-
with open("requirements.txt", "w") as f:
31-
for r in requirements:
32-
f.write(r + "\n")
33-
3428
setup(
3529
name="minfraud",
3630
version=_version,

tests/data/factors-response.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@
108108
"is_satellite_provider": true,
109109
"is_tor_exit_node": true,
110110
"isp": "Andrews & Arnold Ltd",
111+
"mobile_country_code" : "310",
112+
"mobile_network_code" : "004",
111113
"organization": "STONEHOUSE office network",
112114
"user_type": "government"
113115
}

tests/data/insights-response.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@
108108
"is_satellite_provider": true,
109109
"is_tor_exit_node": true,
110110
"isp": "Andrews & Arnold Ltd",
111+
"mobile_country_code" : "310",
112+
"mobile_network_code" : "004",
111113
"organization": "STONEHOUSE office network",
112114
"user_type": "government"
113115
}

tests/test_models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ def test_ip_address(self):
175175
"is_residential_proxy": True,
176176
"is_satellite_provider": True,
177177
"is_tor_exit_node": True,
178+
"mobile_country_code": "310",
179+
"mobile_network_code": "004",
178180
},
179181
}
180182
)
@@ -191,6 +193,8 @@ def test_ip_address(self):
191193
self.assertEqual(True, address.traits.is_residential_proxy)
192194
self.assertEqual(True, address.traits.is_satellite_provider)
193195
self.assertEqual(True, address.traits.is_tor_exit_node)
196+
self.assertEqual("310", address.traits.mobile_country_code)
197+
self.assertEqual("004", address.traits.mobile_network_code)
194198
self.assertEqual(True, address.country.is_high_risk)
195199

196200
self.assertEqual("ANONYMOUS_IP", address.risk_reasons[0].code)

tests/test_webservice.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ def test_200(self):
193193
if self.has_ip_location():
194194
self.assertEqual("United Kingdom", model.ip_address.country.name)
195195
self.assertEqual(True, model.ip_address.traits.is_residential_proxy)
196+
self.assertEqual("310", model.ip_address.traits.mobile_country_code)
197+
self.assertEqual("004", model.ip_address.traits.mobile_network_code)
196198
self.assertEqual("ANONYMOUS_IP", model.ip_address.risk_reasons[0].code)
197199

198200
@httprettified

0 commit comments

Comments
 (0)