Skip to content

Commit 9338693

Browse files
committed
Use correct name for anonymizer confidence
1 parent 22149c7 commit 9338693

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

HISTORY.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ History
1515
package.
1616
* A new ``anonymizer`` object has been added to ``geoip2.models.Insights``.
1717
This object is a ``geoip2.records.Anonymizer`` and contains the following
18-
fields: ``anonymizer_confidence``, ``network_last_seen``, ``provider_name``,
18+
fields: ``confidence``, ``network_last_seen``, ``provider_name``,
1919
``is_anonymous``, ``is_anonymous_vpn``, ``is_hosting_provider``,
2020
``is_public_proxy``, ``is_residential_proxy``, and ``is_tor_exit_node``.
2121
These provide information about VPN and proxy usage.

src/geoip2/records.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class Anonymizer(Record):
270270
This record is returned by ``insights``.
271271
"""
272272

273-
anonymizer_confidence: int | None
273+
confidence: int | None
274274
"""A score ranging from 1 to 99 that represents our percent confidence that
275275
the network is currently part of an actively used VPN service. Currently
276276
only values 30 and 99 are provided. This attribute is only available from
@@ -328,7 +328,7 @@ class Anonymizer(Record):
328328
def __init__(
329329
self,
330330
*,
331-
anonymizer_confidence: int | None = None,
331+
confidence: int | None = None,
332332
is_anonymous: bool = False,
333333
is_anonymous_vpn: bool = False,
334334
is_hosting_provider: bool = False,
@@ -339,7 +339,7 @@ def __init__(
339339
provider_name: str | None = None,
340340
**_: Any,
341341
) -> None:
342-
self.anonymizer_confidence = anonymizer_confidence
342+
self.confidence = confidence
343343
self.is_anonymous = is_anonymous
344344
self.is_anonymous_vpn = is_anonymous_vpn
345345
self.is_hosting_provider = is_hosting_provider

tests/models_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def setUp(self) -> None:
1515
def test_insights_full(self) -> None: # noqa: PLR0915
1616
raw = {
1717
"anonymizer": {
18-
"anonymizer_confidence": 99,
18+
"confidence": 99,
1919
"is_anonymous": True,
2020
"is_anonymous_vpn": True,
2121
"is_hosting_provider": True,
@@ -253,7 +253,7 @@ def test_insights_full(self) -> None: # noqa: PLR0915
253253
geoip2.records.Anonymizer,
254254
"geoip2.records.Anonymizer object",
255255
)
256-
self.assertEqual(model.anonymizer.anonymizer_confidence, 99)
256+
self.assertEqual(model.anonymizer.confidence, 99)
257257
self.assertIs(model.anonymizer.is_anonymous, True)
258258
self.assertIs(model.anonymizer.is_anonymous_vpn, True)
259259
self.assertIs(model.anonymizer.is_hosting_provider, True)
@@ -319,7 +319,7 @@ def test_insights_min(self) -> None:
319319
"Empty names hash returned",
320320
)
321321
# Test that anonymizer fields default correctly
322-
self.assertIsNone(model.anonymizer.anonymizer_confidence)
322+
self.assertIsNone(model.anonymizer.confidence)
323323
self.assertIsNone(model.anonymizer.network_last_seen)
324324
self.assertIsNone(model.anonymizer.provider_name)
325325
self.assertFalse(model.anonymizer.is_anonymous)

0 commit comments

Comments
 (0)