Skip to content

Commit

Permalink
Merge c4e71b6 into 0a41057
Browse files Browse the repository at this point in the history
  • Loading branch information
secynic committed Sep 15, 2020
2 parents 0a41057 + c4e71b6 commit 2ddcc35
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Expand Up @@ -23,6 +23,8 @@ Changelog
- Added support for Python 3.8 (#267)
- Fixed travis build warnings (#268)
- Pinned requirements (#274)
- Added ip_failed_total key to stats dictionary in
experimental.bulk_lookup_rdap (#235)

1.1.0 (2019-02-01)
------------------
Expand Down
26 changes: 14 additions & 12 deletions EXPERIMENTAL.rst
Expand Up @@ -68,21 +68,21 @@ Basic usage
>>>> pprint(results.split('\n'))

[
"Bulk mode; whois.cymru.com [2017-07-30 23:02:21 +0000]",
"15169 | 74.125.225.229 | 74.125.225.0/24 | US | arin | 2007-03-13 | GOOGLE - Google Inc., US",
"15169 | 2001:4860:4860::8888 | 2001:4860::/32 | US | arin | 2005-03-14 | GOOGLE - Google Inc., US",
"Bulk mode; whois.cymru.com [2020-09-15 16:42:29 +0000]",
"15169 | 74.125.225.229 | 74.125.225.0/24 | US | arin | 2007-03-13 | GOOGLE, US",
"15169 | 2001:4860:4860::8888 | 2001:4860::/32 | US | arin | 2005-03-14 | GOOGLE, US",
"2856 | 62.239.237.1 | 62.239.0.0/16 | GB | ripencc | 2001-01-02 | BT-UK-AS BTnet UK Regional network, GB",
"2856 | 2a00:2381:ffff::1 | 2a00:2380::/25 | GB | ripencc | 2007-08-29 | BT-UK-AS BTnet UK Regional network, GB",
"3786 | 210.107.73.73 | 210.107.0.0/17 | KR | apnic | | LGDACOM LG DACOM Corporation, KR",
"3786 | 210.107.73.73 | 210.107.0.0/17 | KR | apnic | 1997-08-29 | LGDACOM LG DACOM Corporation, KR",
"2497 | 2001:240:10c:1::ca20:9d1d | 2001:240::/32 | JP | apnic | 2000-03-08 | IIJ Internet Initiative Japan Inc., JP",
"19373 | 200.57.141.161 | 200.57.128.0/20 | MX | lacnic | 2000-12-04 | Triara.com, S.A. de C.V., MX",
"NA | 2801:10:c000:: | NA | CO | lacnic | 2013-10-29 | NA",
"12091 | 196.11.240.215 | 196.11.240.0/24 | ZA | afrinic | | MTNNS-1, ZA",
"12091 | 196.11.240.215 | 196.11.240.0/24 | ZA | afrinic | 1994-07-21 | MTNNS-1, ZA",
"37578 | 2001:43f8:7b0:: | 2001:43f8:7b0::/48 | KE | afrinic | 2013-03-22 | Tespok, KE",
"4730 | 133.1.2.5 | 133.1.0.0/16 | JP | apnic | | ODINS Osaka University, JP",
"4134 | 115.1.2.3 | 115.0.0.0/14 | KR | apnic | 2008-07-01 | CHINANET-BACKBONE No.31,Jin-rong Street, CN",
"4730 | 133.1.2.5 | 133.1.0.0/16 | JP | apnic | 1997-03-01 | ODINS Osaka University, JP",
"4766 | 115.1.2.3 | 115.0.0.0/12 | KR | apnic | 2008-07-01 | KIXS-AS-KR Korea Telecom, KR",
""
}
]

.. GET_BULK_ASN_WHOIS_OUTPUT_BASIC END
Expand Down Expand Up @@ -175,11 +175,14 @@ The stats dictionary returned by ipwhois.experimental.bulk_lookup_rdap()
'ip_lookup_total' (int) - The total number of addresses that
lookups were attempted for, excluding any that failed ASN
registry checks.
'ip_failed_total' (int) - The total number of addresses that
lookups failed for. Excludes any that failed initially, but
succeeded after further retries.
'lacnic' (dict) -
{
'failed' (list) - The addresses that failed to lookup.
Excludes any that failed initially, but succeeded after
futher retries.
further retries.
'rate_limited' (list) - The addresses that encountered
rate-limiting. Unless an address is also in 'failed',
it eventually succeeded.
Expand Down Expand Up @@ -222,9 +225,7 @@ Basic usage
"total": 2
},
"apnic": {
"failed": [
"115.1.2.3"
],
"failed": [],
"rate_limited": [],
"total": 4
},
Expand All @@ -233,6 +234,7 @@ Basic usage
"rate_limited": [],
"total": 2
},
"ip_failed_total": 0,
"ip_input_total": 12,
"ip_lookup_total": 12,
"ip_unique_total": 12,
Expand Down
7 changes: 6 additions & 1 deletion ipwhois/experimental.py
Expand Up @@ -158,11 +158,14 @@ def bulk_lookup_rdap(addresses=None, inc_raw=False, retry_count=3, depth=0,
'ip_lookup_total' (int) - The total number of addresses that
lookups were attempted for, excluding any that failed ASN
registry checks.
'ip_failed_total' (int) - The total number of addresses that
lookups failed for. Excludes any that failed initially, but
succeeded after further retries.
'lacnic' (dict) -
{
'failed' (list) - The addresses that failed to lookup.
Excludes any that failed initially, but succeeded after
futher retries.
further retries.
'rate_limited' (list) - The addresses that encountered
rate-limiting. Unless an address is also in 'failed',
it eventually succeeded.
Expand Down Expand Up @@ -196,6 +199,7 @@ def bulk_lookup_rdap(addresses=None, inc_raw=False, retry_count=3, depth=0,
'ip_input_total': len(addresses),
'ip_unique_total': 0,
'ip_lookup_total': 0,
'ip_failed_total': 0,
'lacnic': {'failed': [], 'rate_limited': [], 'total': 0},
'ripencc': {'failed': [], 'rate_limited': [], 'total': 0},
'apnic': {'failed': [], 'rate_limited': [], 'total': 0},
Expand Down Expand Up @@ -425,6 +429,7 @@ def bulk_lookup_rdap(addresses=None, inc_raw=False, retry_count=3, depth=0,

del asn_parsed_results[ip]
stats[rir]['failed'].append(ip)
stats['ip_failed_total'] += 1

if rir == 'lacnic':

Expand Down
3 changes: 2 additions & 1 deletion ipwhois/tests/online/test_experimental.py
Expand Up @@ -67,7 +67,8 @@ def test_bulk_lookup_rdap(self):
'115.1.2.3' # KRNIC
]

expected_stats = {'ip_input_total': 12, 'ip_unique_total': 12, 'ip_lookup_total': 12,
expected_stats = {'ip_input_total': 12, 'ip_unique_total': 12,
'ip_lookup_total': 12, 'ip_failed_total': 0,
'lacnic': {'failed': [], 'rate_limited': [], 'total': 2},
'ripencc': {'failed': [], 'rate_limited': [], 'total': 2},
'apnic': {'failed': [], 'rate_limited': [], 'total': 4},
Expand Down

0 comments on commit 2ddcc35

Please sign in to comment.