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 5a0acc9

Browse files
Merge pull request avinashkranjan#2099 from sabhisharma-ise/Domain
added Domain_name.py
2 parents 1f3c3c3 + 19bf3c6 commit 5a0acc9

File tree

5 files changed

+103
-2
lines changed

5 files changed

+103
-2
lines changed

‎Domain_Name_Availability/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
API_KEY = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
2+
API_SECRET = "XXXXXXXXXXXXXXXXXXXXXX"
3+
4+
// Here you have to save your own Private Access API and Secret Key which will be used in Main code to fetch the data

‎Domain_Name_Availability/Domain_name.py

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: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
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-
| 109\. | Automatic Spelling Checker and Corrector | This Script is used to detect spelling errors in a text and correct them if the user wishes to do so. | [Take Me](./Automatic_Spelling_Checker_Corrector/) | [Sabhi Sharma](https//github.com/sabhisharma-ise)
113-
| 110\. | File Searcher | The File Search script is a Python tool that allows you to search for files with a specific extension in a directory. It recursively searches through all subdirectories of the specified directory and returns a list of files that match the provided file extension. | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/File\Search) | [Srujana Vanka](https://github.com/srujana-16)
112+
| 109\. | 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)
113+
| 110\. | Automatic Spelling Checker and Corrector | This Script is used to detect spelling errors in a text and correct them if the user wishes to do so. | [Take Me](./Automatic_Spelling_Checker_Corrector/) | [Sabhi Sharma](https//github.com/sabhisharma-ise)
114+
| 111\. | File Searcher | The File Search script is a Python tool that allows you to search for files with a specific extension in a directory. It recursively searches through all subdirectories of the specified directory and returns a list of files that match the provided file extension. | [Take Me](https://github.com/avinashkranjan/Amazing-Python-Scripts/tree/master/File\Search) | [Srujana Vanka](https://github.com/srujana-16)
114115

0 commit comments

Comments
(0)

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