Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 964d719

Browse files
added Domain_name.py
1 parent 7cd99a7 commit 964d719

File tree

4 files changed

+97
-1
lines changed

4 files changed

+97
-1
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import requests
2+
import decouple
3+
4+
req_headers = {}
5+
6+
7+
def godaddy_credentials():
8+
"""
9+
This functions reads your credentials from .env file
10+
"""
11+
global req_headers
12+
13+
print("\n\t::: Reading Godaddy Credentials :::")
14+
15+
api_key = decouple.config("API_KEY")
16+
api_secret = decouple.config("API_SECRET")
17+
# api_key = input("\nEnter your API Key: ")
18+
# api_secret = input("Enter your SECRET Key: ")
19+
20+
req_headers = {
21+
"Authorization": f"sso-key {api_key}:{api_secret}",
22+
"accept": "application/json",
23+
}
24+
25+
26+
def get_url(domain_name):
27+
"""
28+
creating the required URL from domain name
29+
:param domain_name: (string) domain name
30+
:return: URL
31+
"""
32+
return f"https://api.ote-godaddy.com/v1/domains/suggest?query={domain_name}&country=IN&waitMs=1000"
33+
34+
35+
def available_domain_names():
36+
"""
37+
This function takes godaddy credentials from the user and generates all the
38+
available domain names in a text file.
39+
"""
40+
godaddy_credentials()
41+
domain_name = input("\nEnter required DOMAIN Name: ")
42+
url = get_url(domain_name)
43+
44+
print("\nSearching for the available domains")
45+
res = requests.get(url, headers=req_headers)
46+
47+
if res.status_code == 200:
48+
# Output is in JSON file so reading it.
49+
response = res.json()
50+
51+
# Saving our available domains in a text file.
52+
print(f"\nSaving all the available domain names in {domain_name}.txt file")
53+
f = open(f"{domain_name}.txt", "a")
54+
for i in response:
55+
f.writelines(i["domain"] + "\n")
56+
f.close()
57+
print(f"\nFile {domain_name}.txt saved successfully in your current directory")
58+
59+
else:
60+
print("Error Status Code")
61+
62+
63+
if __name__ == "__main__":
64+
available_domain_names()

‎Domain_Name_Availability/README.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Domain Name Availabilty Checker
2+
3+
- The python script uses GoDaddy's API to get all the domain names which are available according to the keyword given by user.
4+
- All the results are stored in a ```.txt``` file, named after the keyword.
5+
6+
7+
## Setup
8+
9+
- A virtual environment.
10+
- `pip install -r requirements.txt`
11+
- Generate your GoDaddy API KEY and Secret KEY from [here](https://developer.godaddy.com/keys)
12+
- Paste the token in a `.env` file (Take [`.env.example`](.env.example) as an example)
13+
14+
## Running the script:
15+
16+
17+
```sh
18+
$ python Domain_name.py
19+
```
20+
21+
## Working screenshots:
22+
23+
![Image](https://i.imgur.com/mZcXwJZ.png)
24+
25+
![Image](https://i.imgur.com/BUzocy9.png)
26+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
certifi==2020年12月5日
2+
chardet==4.0.0
3+
idna==2.10
4+
python-decouple==3.4
5+
requests==2.25.1
6+
urllib3==1.26.4

‎SCRIPTS.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,4 @@
109109
| 107\. | ISBN Number Validator Script | Full form of ISBN number - International Standard Book Numbers. This python script can verify the entered number is valid isbn number or not. | [Take Me](./ISBN-Number-Validator/) | [Avdhesh Varshney](https://github.com/Avdhesh-Varshney)
110110
| 107\. | Image Classification | This script performs image classification using the MobileNetV2 pre-trained model provided by TensorFlow. It allows you to classify images into different categories based on the ImageNet dataset. | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/Image\Classification) | [Srujana Vanka](https://github.com/srujana-16)
111111
| 108\. | Check External IP Address | This is a basic Python script for determining your external IP address. | [Take Me](./Check_External_IP) | [Sabhi Sharma](https//github.com/sabhisharma-ise)
112-
112+
| 110\. | Domain Name Availability Checker | This script is a Python tool that allows you to check the availability of domain names using the GoDaddy API. | [Take Me](./Domain_Name_Availability/) | [Sabhi Sharma](https//github.com/sabhisharma-ise)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /