IPGeo Search
v1.0.1: Updated redundancy
IPGEO-SEARCH是一個Python模塊,可輕鬆使用IPGEO API。它允許免費和付費用戶僅以一行代碼將請求發送到服務器,從而自定義如何加載IP列表。我們在網頁上為我們的API提供為期5天的免費試用版。要獲取免費試用API密鑰,請聯繫我們的實驗室,我們將其發送給您。
要安裝ipgeosearch,請運行
pip install IPGeoSearch在本地計算機上運行之前,請確保已安裝了最新版本的pandas python 3.6+ 。
要安裝熊貓,請運行:
pip install pandassearch功能帶有3個參數:
ipList: an Array of IP's where each IP is a string.
path: Where the result files are downloaded to.
key: The API Key sent to you.
要使用任何一個版本,您必須向服務器提供密鑰。
from IPGeoSearch import search
with open ( 'ipList.txt' , 'r' ) as f :
ip = [ line . strip () for line in f ]
f . close ()
with open ( 'yourkey.key' , 'r' ) as hashkey :
key = hashkey . read (). replace ( ' n ' , '' )
hashkey . close ()
search . search ( ipList = ip , path = '' , key = key )常見錯誤是:
TypeError : "An entry in ipList is not a string at line and cannot be read by the server"
RuntimeError : "Your Key is Invalid. Please purchase a key or start a trial."
RuntimeError : "Your Trial Period has expired. Please purchase a key."
RuntimeError : "Your Key has expired. Please purchase a new key."
RuntimeError : "The Network you are using in unknown and key cannot be secured. Please change networks."
RuntimeError : "Your Key is being used on a different network than it was registered on. Please use your original network or purchase a new key for this network."
ValueError : "IP list was not specified."
ValueError : "Key was not specified."如果您收到一個錯誤:
RuntimeError : "Something went really wrong. Either the IP does not exist in the database, server is down, or another error occured. Check x.x.x.x.json for more details and file an issue if you are unable to solve the problem."提出問題,以便我們的團隊可以為您提供幫助。