add domainr
This commit is contained in:
parent
0dc1c3630a
commit
3b26e02b48
1 changed files with 26 additions and 0 deletions
26
domainr
Executable file
26
domainr
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
from sys import argv
|
||||
from httplib import HTTPConnection
|
||||
|
||||
import json
|
||||
|
||||
def main(args):
|
||||
for arg in args:
|
||||
print "Looking up domains for %s..." % arg
|
||||
|
||||
con = HTTPConnection('domai.nr')
|
||||
req = con.request('GET', '/api/json/search?q=%s' % arg)
|
||||
res = con.getresponse()
|
||||
|
||||
if res.status == 200:
|
||||
data = res.read()
|
||||
sites = json.loads(data)
|
||||
|
||||
for s in sites['results']:
|
||||
print "\t%s - %s" % (s['domain'], s['availability'])
|
||||
else:
|
||||
print "Uh oh, you got a %s %s. What the dilly?" % (res.status, res.reason)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main(argv[1:])
|
||||
Loading…
Reference in a new issue