-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCheckDomain.py
48 lines (33 loc) · 1.07 KB
/
CheckDomain.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import requests, json, time
from credentials import API_KEY, API_SECRET, TOKEN
def CheckDomain(name):
print("Searching "+ name + ".com ...")
headers = {
'accept': 'application/json',
'Authorization': 'sso-key '+API_KEY+':'+API_SECRET,
}
params = {
('domain', name+'.com'),
('checkType', 'FAST'),
('forTransfer', 'false'),
}
response = requests.get('https://api.ote-godaddy.com/v1/domains/available', headers=headers, params=params)
accessible = response.json().get('available')
if accessible == True:
print(name+'.com is available!')
f.write(name+'.com is available\r\n')
time.sleep(2)
file = open('animals.json')
data = json.load(file)
f = open('AvailableWebsites.txt', 'w')
choice = int(input("Text file [1] or Json file [2]? "))
if choice == 1:
with open ('domains.txt', 'rt') as filetxt:
for name in filetxt:
CheckDomain(name.lower().rstrip())
elif choice == 2:
print(choice)
for name in data:
CheckDomain(name)
f.close()
file.close()