Skip to content

Instantly share code, notes, and snippets.

@FZX
Created February 4, 2017 22:04
Show Gist options
  • Save FZX/3bacd26d847ca048743204d9ebad9130 to your computer and use it in GitHub Desktop.
Save FZX/3bacd26d847ca048743204d9ebad9130 to your computer and use it in GitHub Desktop.
Python3 Check domain with Godaddy API
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# Distributed under terms of the MIT license.
import requests
def check_domain(domain):
data = {"domain": domain}
respond = requests.get("https://api.ote-godaddy.com/v1/domains/available", params=data)
respond_result = respond.json()["available"]
return respond_result
print(check_domain("google.com"))
@FZX
Copy link
Author

FZX commented Feb 4, 2017

# -*- coding: utf-8 -*-
# vim:fenc=utf-8

import requests


def check_domain(domain):
    data = {"domain": domain}
    respond = requests.get("https://api.ote-godaddy.com/v1/domains/available",
                           params=data)
    respond_result = respond.json()["available"]
    print("Checking: ", domain, respond_result)
    return respond_result

count = 0
file_name = "domain0.txt"
file_number = 0
domain_tld = ".co"
domain = set()
for a in range(65,91):
    for b in range(65,91):
        for c in range(65,91):

            domain.add("{}{}{}".format(chr(a), chr(b), chr(c)))
for dom in domain:
    if check_domain(dom + domain_tld):
        with open(file_name, "a") as f:
            f.write(dom+"\n")
            if count == 499:
                count = 0
                file_number += 1
                file_name = "domain{}.txt".format(file_number)
            count += 1

print("Generated {} files".format(file_number))```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment