Python 3 Integration

Python 3 module (using urllib.request)

import urllib.request
import json

def Lookup(ip):

	response = urllib.request.Request("http://v2.api.iphub.info/ip/{}".format(ip))
	response.add_header("X-Key", "YOUR_API_KEY_HERE")
	
	try:
		response = json.loads(urllib.request.urlopen(response).read().decode())
	except:
		return False # In the case of an error, pass all IP's to avoid blocking innocents

	return response.get("block") # Defaults to None if failed to get block value

To query an IP; you save the IPHub module in the same directory as your code and name it as IPHub.py then import it like a regular module:

import IPHub
IPHub.Lookup("8.8.8.8") # returns True