時間:2023-02-13 08:06:01 | 來源:建站知識
時間:2023-02-13 08:06:01 來源:建站知識
IP查詢的APIimport requestsimport json# IP address to testip_address = '147.229.2.90'request_url = 'https://geolocation-db.com/jsonp/' + ip_addressresponse = requests.get(request_url)result = response.content.decode()result = result.split("(")[1].strip(")")result = json.loads(result)print(result)
import socketdef URL2IP(): for oneurl in urllist.readlines(): url=str(oneurl.strip())[7:] print url try: ip =socket.gethostbyname(url) print ip iplist.writelines(str(ip)+"/n") except: print "this URL 2 IP ERROR "try: urllist=open("D:/urllist.txt","r") iplist=open("D:/iplist.txt","w") URL2IP() urllist.close() iplist.close() print "complete !"except: print "ERROR !"
Python--域名解析成IP地址_LandGrey的博客-CSDN博客_python解析域名ip關鍵詞:判斷,國家,屬地
微信公眾號
版權所有? 億企邦 1997-2025 保留一切法律許可權利。