From 5956e8f0e1d5779cdcdcda6396b0e55264336fe6 Mon Sep 17 00:00:00 2001 From: Vlad C Date: Tue, 25 Feb 2020 12:43:17 +0200 Subject: [PATCH] Optimize GetASN() Removed python dependency; ip-api can return specific fields in raw text, there's no need to call Python to parse the JSON response. --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index e448570..d6c8763 100644 --- a/README.md +++ b/README.md @@ -4224,7 +4224,6 @@ Unsuccessful domain name resolution. ```bash # Dependencies: # - curl -# - python function GetASN() { @@ -4233,8 +4232,7 @@ function GetASN() { local _curl_base="curl --request GET" local _timeout="15" - _asn=$($_curl_base -ks -m "$_timeout" "http://ip-api.com/json/${_ip}" | \ - python -c 'import sys, json; print json.load(sys.stdin)["as"]' 2>/dev/null) + _asn=$($_curl_base -ks -m "$_timeout" "http://ip-api.com/line/${_ip}?fields=as") _state=$(echo $?)