url-abuse/client/bin/urlabuse

29 lines
740 B
Plaintext
Raw Normal View History

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
from pyurlabuse import PyURLAbuse
import json
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Run a query against URL Abuse')
parser.add_argument('--url', type=str, help='URL of the instance.')
parser.add_argument('--query', help='URL to lookup')
2019-01-15 16:20:38 +01:00
parser.add_argument('--digest', action='store_true', help='Return the digest')
args = parser.parse_args()
if args.url:
urlabuse = PyURLAbuse(args.url)
else:
urlabuse = PyURLAbuse()
2019-01-15 16:20:38 +01:00
response = urlabuse.run_query(args.query, args.digest)
if args.digest:
print(response['digest'][0])
else:
print(json.dumps(response, indent=2))