Skip to content

Commit 6bd16e6

Browse files
committed
Remove deprecate attribute
1 parent fc4a5f9 commit 6bd16e6

File tree

3 files changed

+2
-38
lines changed

3 files changed

+2
-38
lines changed

HISTORY.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ History
1212
classes are no longer immutable. For most users, these differences should
1313
not impact their integration.
1414
* BREAKING CHANGE: Model attributes that were formerly tuples are now lists.
15+
* BREAKING CHANGE: The deprecated `is_high_risk` attribute on
16+
`resp.ip_address.country` has been removed.
1517
* IMPORTANT: Python 3.9 or greater is required. If you are using an older
1618
version, please use an earlier release.
1719
* Added ``to_dict`` methods to the model classes. These return a dict version

minfraud/models.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -116,34 +116,6 @@ def __init__(self, *args, **kwargs) -> None:
116116
super().__init__(*args, **kwargs)
117117

118118

119-
class GeoIP2Country(geoip2.records.Country):
120-
"""Country information for the IP address.
121-
122-
In addition to the attributes provided by ``geoip2.records.Country``,
123-
this class provides:
124-
125-
.. attribute:: is_high_risk
126-
127-
This is true if the IP country is high risk.
128-
129-
:type: bool | None
130-
131-
.. deprecated:: 1.8.0
132-
Deprecated effective August 29, 2019.
133-
134-
Parent:
135-
136-
"""
137-
138-
__doc__ += geoip2.records.Country.__doc__ # type: ignore
139-
140-
is_high_risk: bool
141-
142-
def __init__(self, *args, **kwargs) -> None:
143-
self.is_high_risk = kwargs.get("is_high_risk", False)
144-
super().__init__(*args, **kwargs)
145-
146-
147119
class IPAddress(geoip2.models.Insights):
148120
"""Model for minFraud and GeoIP2 data about the IP address.
149121
@@ -222,7 +194,6 @@ class IPAddress(geoip2.models.Insights):
222194
223195
"""
224196

225-
country: GeoIP2Country
226197
location: GeoIP2Location
227198
risk: Optional[float]
228199
risk_reasons: List[IPRiskReason]
@@ -248,7 +219,6 @@ def __init__(
248219
kwargs["risk_reasons"] = risk_reasons
249220

250221
super().__init__(kwargs, locales=list(locales or []))
251-
self.country = GeoIP2Country(locales, **(country or {}))
252222
self.location = GeoIP2Location(**(location or {}))
253223
self.risk = risk
254224
self.risk_reasons = [IPRiskReason(**x) for x in risk_reasons or []]

tests/test_models.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,6 @@ def test_email_domain(self):
108108

109109
self.assertEqual(first_seen, domain.first_seen)
110110

111-
def test_geoip2_country(self):
112-
country = GeoIP2Country(is_high_risk=True, iso_code="US")
113-
self.assertEqual(True, country.is_high_risk)
114-
self.assertEqual("US", country.iso_code)
115-
116111
def test_geoip2_location(self):
117112
time = "2015-04-19T12:59:23-01:00"
118113
location = GeoIP2Location(local_time=time, latitude=5)
@@ -124,7 +119,6 @@ def test_ip_address(self):
124119
address = IPAddress(
125120
["en"],
126121
country={
127-
"is_high_risk": True,
128122
"is_in_european_union": True,
129123
},
130124
location={
@@ -156,7 +150,6 @@ def test_ip_address(self):
156150
)
157151

158152
self.assertEqual(time, address.location.local_time)
159-
self.assertEqual(True, address.country.is_high_risk)
160153
self.assertEqual(True, address.country.is_in_european_union)
161154
self.assertEqual(99, address.risk)
162155
self.assertEqual(True, address.traits.is_anonymous)
@@ -169,7 +162,6 @@ def test_ip_address(self):
169162
self.assertEqual(True, address.traits.is_tor_exit_node)
170163
self.assertEqual("310", address.traits.mobile_country_code)
171164
self.assertEqual("004", address.traits.mobile_network_code)
172-
self.assertEqual(True, address.country.is_high_risk)
173165

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

0 commit comments

Comments
 (0)