python xgboost example
Example 1: google.protobuf.Struct example python
from google.protobuf.internal.well_known_types import Struct
s = Struct()
s.update({"key": "value"})
Example 2: python pygeoip example
def main(argv):
parseargs(argv)
print(BANNER.format(APP_NAME, VERSION))
print("[+] Resolving host...")
host = gethostaddr()
if (host is None or not host):
print("[!] Unable to resolve host {}".format(target))
print("[!] Make sure the host is up: ping -c1 {}\n".format(target))
sys.exit(0)
print("[+] Host {} has address: {}".format(target, host))
print("[+] Tracking host...")
query = pygeoip.GeoIP(DB_FILE)
result = query.record_by_addr(host)
if (result is None or not result):
print("[!] Host location not found")
sys.exit(0)
print("[+] Host location found:")
print json.dumps(result, indent=4, sort_keys=True, ensure_ascii=False, encoding="utf-8")