From 00d959dc16410fa92c0271e118d4290463d38c1e Mon Sep 17 00:00:00 2001 From: secynic Date: Sun, 5 Mar 2017 21:21:11 -0600 Subject: [PATCH] docstring/docs update for asn_alts/allow_permutations deprecation, asn_methods addition (#158) --- ASN.rst | 6 ++++++ CLI.rst | 13 +++++++++---- RDAP.rst | 7 ++++++- README.rst | 9 ++++++++- WHOIS.rst | 6 ++++++ ipwhois/ipwhois.py | 3 ++- ipwhois/net.py | 2 +- ipwhois/scripts/ipwhois_cli.py | 6 ++++-- 8 files changed, 42 insertions(+), 10 deletions(-) diff --git a/ASN.rst b/ASN.rst index 573258f..8ba3b54 100644 --- a/ASN.rst +++ b/ASN.rst @@ -26,6 +26,12 @@ Arguments supported by IPASN.lookup(). | | | attempt if the ASN dns lookup fails. | | | | Allow permutations must be enabled. | | | | Defaults to all ['whois', 'http']. | +| | | *WARNING* deprecated in favor of new | +| | | argument asn_methods. | ++------------------------+--------+-------------------------------------------+ +| asn_methods | List | Array of ASN lookup types to attempt, in | +| | | order. Defaults to all | +| | | ['dns', 'whois', 'http']. | +------------------------+--------+-------------------------------------------+ | extra_org_map | List | Dictionary mapping org handles to RIRs. | | | | This is for limited cases where ARIN REST | diff --git a/CLI.rst b/CLI.rst index 539d95f..ef6a77a 100644 --- a/CLI.rst +++ b/CLI.rst @@ -8,7 +8,8 @@ installed to your Python environment Scripts directory. - ipwhois_cli.py has full ipwhois.py functionality. - ipwhois_utils_cli.py has full utils.py functionality. -- The others (net.py, rdap.py, whois.py) will be included in a future release. +- The others (net.py, rdap.py, whois.py, nir.py, asn.py) will be included in a + future release. ipwhois_cli.py ============== @@ -21,8 +22,8 @@ ipwhois_cli.py [-h] [--whois] [--exclude_nir] [--json] [--hr] [--proxy_http "PROXY_HTTP"] [--proxy_https "PROXY_HTTPS"] [--disallow_permutations] [--inc_raw] [--retry_count RETRY_COUNT] - [--asn_alts "ASN_ALTS"] [--extra_org_map "ASN_ALTS"] - [--depth COLOR_DEPTH] + [--asn_alts "ASN_ALTS"] [--asn_methods "ASN_METHODS"] + [--extra_org_map "EXTRA_ORG_MAP"] [--depth COLOR_DEPTH] [--excluded_entities "EXCLUDED_ENTITIES"] [--bootstrap] [--rate_limit_timeout RATE_LIMIT_TIMEOUT] [--get_referral] [--extra_blacklist "EXTRA_BLACKLIST"] @@ -62,7 +63,8 @@ IPWhois settings: Disable additional methods if DNS lookups to Cymru fail. This is the opposite of the ipwhois allow_permutations, in order to enable - allow_permutations by default in the CLI. + allow_permutations by default in the CLI. *WARNING* + deprecated in favor of new argument asn_methods. Common settings (RDAP & Legacy Whois): --inc_raw Include the raw whois results in the output. @@ -74,6 +76,9 @@ Common settings (RDAP & Legacy Whois): attempt if the ASN dns lookup fails. Allow permutations must be enabled. Defaults to all: "whois,http" + --asn_methods ASN_METHODS + Array of ASN lookup types to attempt, in order. + Defaults to all ['dns', 'whois', 'http']. --extra_org_map ASN_ALTS Dictionary mapping org handles to RIRs. This is for limited cases where ARIN REST (ASN fallback HTTP diff --git a/RDAP.rst b/RDAP.rst index 7116a05..f3a6298 100644 --- a/RDAP.rst +++ b/RDAP.rst @@ -43,7 +43,12 @@ Arguments supported by IPWhois.lookup_rdap(). | asn_alts | List | Array of additional lookup types to attempt if| | | | the ASN dns lookup fails. Allow permutations | | | | must be enabled. Defaults to all | -| | | ['whois', 'http']. | +| | | ['whois', 'http']. *WARNING* deprecated in | +| | | favor of new argument asn_methods. | ++--------------------+--------+-----------------------------------------------+ +| asn_methods | List | Array of ASN lookup types to attempt, in | +| | | order. Defaults to all | +| | | ['dns', 'whois', 'http']. | +--------------------+--------+-----------------------------------------------+ | extra_org_map | Dict | Dictionary mapping org handles to RIRs. | | | | This is for limited cases where ARIN REST | diff --git a/README.rst b/README.rst index f115142..6ee90f1 100644 --- a/README.rst +++ b/README.rst @@ -24,6 +24,11 @@ Summary ipwhois is a Python package focused on retrieving and parsing whois data for IPv4 and IPv6 addresses. +.. attention:: + + The IPWhois argument allow_permutations and the lookup argument asn_alts + have been deprecated in favor of new argument asn_methods. + .. attention:: NIR (National Internet Registry) lookups are enabled by default as of @@ -192,7 +197,9 @@ Input | | | proxy support or None. | +--------------------+--------+-----------------------------------------------+ | allow_permutations | Bool | Allow net.Net() to use additional methods if | -| | | DNS lookups to Cymru fail. | +| | | DNS lookups to Cymru fail. *WARNING* | +| | | deprecated in favor of new argument | +| | | asn_methods. | +--------------------+--------+-----------------------------------------------+ RDAP (HTTP) diff --git a/WHOIS.rst b/WHOIS.rst index d4acb82..8425228 100644 --- a/WHOIS.rst +++ b/WHOIS.rst @@ -54,6 +54,12 @@ Arguments supported by IPWhois.lookup_whois(). | | | attempt if the ASN dns lookup fails. | | | | Allow permutations must be enabled. | | | | Defaults to all ['whois', 'http']. | +| | | *WARNING* deprecated in favor of new | +| | | argument asn_methods. | ++------------------------+--------+-------------------------------------------+ +| asn_methods | List | Array of ASN lookup types to attempt, in | +| | | order. Defaults to all | +| | | ['dns', 'whois', 'http']. | +------------------------+--------+-------------------------------------------+ | extra_org_map | Dict | Dictionary mapping org handles to RIRs. | | | | This is for limited cases where ARIN | diff --git a/ipwhois/ipwhois.py b/ipwhois/ipwhois.py index 6ab9816..058ef05 100644 --- a/ipwhois/ipwhois.py +++ b/ipwhois/ipwhois.py @@ -42,7 +42,8 @@ class IPWhois: proxy_opener: The urllib.request.OpenerDirector request for proxy support or None. allow_permutations: allow net.Net() to use additional methods if DNS - lookups to Cymru fail. + lookups to Cymru fail. *WARNING* deprecated in favor of new + argument asn_methods. """ def __init__(self, address, timeout=5, proxy_opener=None, diff --git a/ipwhois/net.py b/ipwhois/net.py index fd37bdf..8e53ecd 100644 --- a/ipwhois/net.py +++ b/ipwhois/net.py @@ -101,7 +101,7 @@ class Net: proxy_opener: The urllib.request.OpenerDirector request for proxy support or None. allow_permutations: Use additional methods if DNS lookups to Cymru - fail. + fail. *WARNING* deprecated in favor of new argument asn_methods. Raises: IPDefinedError: The address provided is defined (does not need to be diff --git a/ipwhois/scripts/ipwhois_cli.py b/ipwhois/scripts/ipwhois_cli.py index de3afdf..f488638 100644 --- a/ipwhois/scripts/ipwhois_cli.py +++ b/ipwhois/scripts/ipwhois_cli.py @@ -155,7 +155,8 @@ group.add_argument( action='store_true', help='Disable additional methods if DNS lookups to Cymru fail. This is the' ' opposite of the ipwhois allow_permutations, in order to enable ' - 'allow_permutations by default in the CLI.', + 'allow_permutations by default in the CLI. *WARNING* deprecated in ' + 'favor of new argument asn_methods.', default=False ) @@ -348,7 +349,8 @@ class IPWhoisCLI: proxy_https: The urllib.request.ProxyHandler dictionary for proxy HTTPS support or None. allow_permutations: allow net.Net() to use additional methods if DNS - lookups to Cymru fail. + lookups to Cymru fail. *WARNING* deprecated in favor of new + argument asn_methods. """ def __init__(