IPGEO-Search-это модуль Python, который позволяет легко использовать API IPGEO. Это позволяет как бесплатным, так и платным пользователям отправлять запросы на сервер всего за одну строку кода, что позволяет настраивать их списки IP. Мы предлагаем 5 -дневную бесплатную пробную версию для нашего API на нашей веб -странице. Чтобы получить бесплатный пробный API, свяжитесь с нашей лабораторией, и мы отправим его вам.
Чтобы установить ipgeosearch, запустите
pip install IPGeoSearch Перед запуском на местном компьютере убедитесь, что у вас есть python 3.6+ с последней версией pandas .
Чтобы установить панды, запустите:
pip install pandas Функция search принимает 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."Подайте проблему, чтобы наша команда могла помочь вам.