Commit a7590ebe authored by Johannes Winter's avatar Johannes Winter

initial commit

parents
#!/usr/bin/env python
## imports
import json
import requests
import os, sys
## loaders
from dotenv import load_dotenv
env_path = os.path.abspath ( os.path.join ( os.curdir, os.path.relpath('.env') ) )
load_dotenv(verbose=True, dotenv_path=env_path)
## constants
MODOBOA_API_BASE = os.getenv("MODOBOA_API_BASE")
PDNS_API_BASE = os.getenv("PDNS_API_BASE")
MODOBOA_TOKEN = os.getenv("MODOBOA_TOKEN")
PDNS_TOKEN = os.getenv("PDNS_TOKEN")
def search_pdns(query):
payload = {
'q': query,
'max': 10000,
'object_type': 'all'
}
r = requests.get(PDNS_API_BASE + 'search-data', headers={'X-API-Key': PDNS_TOKEN}, params=payload)
return r.json()
def pprint(text):
print json.dumps(text, sort_keys=True, indent=4, separators=(',', ': '))
if len(sys.argv) > 1:
[pprint(result) for result in search_pdns(sys.argv[1])]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment