IPGeo-Search is a python module which allows for easy use of the IPGeo API. It allows both free and paid users to send requests to the server in just one line of code, allowing for customization of how IP lists are loaded.
Project description
IPGeo-Search
About
IPGeo-Search is a python module which allows for easy use of the IPGeo API. It allows both free and paid users to send requests to the server in just one line of code, allowing for customization of how IP lists are loaded. We offer both a paid and free versions of our API on Our Webpage.
Requirements
Before running on your local computer, make sure you have python 3.6+
with the latest version of pandas
installed.
To Install Pandas, run:
pip install pandas
Usage
The search
function takes in 4 arguments:
ipList: an Array of IP's where each IP is a string
path: Where the result files are downloaded to
key(optional): The API Key if you use the paid version.
key_type(optional): Specifies what type of API key you are using
Examples
Free Version
The IP List in this example is generated from a text document with an IP Address on each line.
from IPGeoSearch import search
with open('ipList.txt', 'r') as f:
ips = [line.strip() for line in f]
f.close()
search.search(ipList=ips,path='path/for/download')
You can also have run a preprocessing script before which returns IP's into an IP list.
ips = []
'''
Preprocessing Script that appends to ips
'''
search.search(ipList=ips,path='path/for/download')
Paid Version
To use the paid version, you must supply your key to the server as well as specify the key type.
from IPGeoSearch import search
with open('ipList.txt', 'r') as f:
ips = [line.strip() for line in f]
f.close()
search.search(ipList=ips,path='path/for/download',key='key',key_type='key_type)
Valid Key types are basic, premium, deluxe, or ultra
.
Errors
Common Errors are:
TypeError: "An entry in ipList is not a string at line and cannot be read by the server"
ValueError: "Your IP List is longer than (10,1000,10000,100000) entires, which is more than alloted for your version. Sending it would result in an error from the server. Please shorten your list so that all your IP's may be processed."
RuntimeError: "You Have Exceded your Monthly search Limit"
TypeError: "A key type was inputed was not a valid key type. Valid Key types are: basic, premium, deluxe, and ultra"
TypeError: "A key was inputed but a valid key type was not specified. Valid Key types are: basic, premium, deluxe, and ultra"
If you receive an error like:
RuntimeError: "Something went really wrong. Either the IP does not exist in the database, they key is not valid, 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."
File an issue so our team can assist you.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for IPGeoSearch-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91c0e7ce3966b7a47762d325caf4fd682e90103412901729c5d668c237f4d98b |
|
MD5 | 46c6ca23da5676ff6a38892c6bf89b7d |
|
BLAKE2b-256 | ffa00030b0904656cba5752ac1c9b0f9d61594e0214a13bd8e90c21eee2491a5 |