Skip to content

Commit 38483b8

Browse files
committed
Update docs and change log
1 parent 5132390 commit 38483b8

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

HISTORY.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ History
1414
``ipaddress.IPv6Address`` objects in addition to strings. This works with
1515
both the pure Python implementation as well as the extension. Based on a
1616
pull request #48 by Eric Pruitt. GitHub #50.
17+
* A new method, ``get_with_prefix_len`` was added. This method returns a
18+
tuple containing the record and the prefix length.
1719

1820
1.4.1 (2018-06-22)
1921
++++++++++++++++++

README.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ corresponding values for the IP address from the database (e.g., a dictionary
6262
for GeoIP2/GeoLite2 databases). If the database does not contain a record for
6363
that IP address, the method will return ``None``.
6464

65+
If you wish to also retrieve the prefix length for the record, use the
66+
``get_with_prefix_len`` method. This returns a tuple containing the record
67+
followed by the network prefix length associated with the record.
68+
6569
Example
6670
-------
6771

@@ -70,9 +74,13 @@ Example
7074
>>> import maxminddb
7175
>>>
7276
>>> reader = maxminddb.open_database('GeoLite2-City.mmdb')
77+
>>>
7378
>>> reader.get('1.1.1.1')
7479
{'country': ... }
7580
>>>
81+
>>> reader.get_with_prefix_len('1.1.1.1')
82+
({'country': ... }, 24)
83+
>>>
7684
>>> reader.close()
7785
7886
Exceptions

0 commit comments

Comments
 (0)