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.
11
pybusedb.py
11
pybusedb.py
@ -15,5 +15,12 @@ class APIConnect(object):
|
|||||||
|
|
||||||
def checkIP(self, ip):
|
def checkIP(self, ip):
|
||||||
self.ip = ip
|
self.ip = ip
|
||||||
self.URL = self.baseAPIURL + self.checkIPURL + self.ip + '/json' '?key=%s' % self.APIKEY
|
#checks to see if we supplied a valid IPv4
|
||||||
print(self.URL)
|
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