Added IP lookup functionality to the lib
This commit is contained in:
parent
a71db93722
commit
b136bf7568
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
__pycache__
|
||||
Binary file not shown.
@ -15,5 +15,12 @@ class APIConnect(object):
|
||||
|
||||
def checkIP(self, ip):
|
||||
self.ip = ip
|
||||
#checks to see if we supplied a valid IPv4
|
||||
if re.match('\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}', self.ip):
|
||||
self.URL = self.baseAPIURL + self.checkIPURL + self.ip + '/json' '?key=%s' % self.APIKEY
|
||||
print(self.URL)
|
||||
r = requests.get(self.URL)
|
||||
jsonData = r.json()
|
||||
return jsonData
|
||||
else:
|
||||
return "Invalid IP"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user