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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 import requests import time from datetime import datetime # Dynadot API endpoint and key DYNADOT_API_ENDPOINT = 'https://api.dynadot.com/api3.xml' DYNADOT_API_KEY = 'YOURAPIHERE' # List of domain names to register DOMAIN_LIST = ['domain1.com', 'domain2.com', 'domain3.com'] def check_domain_availability_dynadot(domain_name): try: params = { 'key': DYNADOT_API_KEY, 'command': 'search', 'domain0': domain_name } response = requests.get(DYNADOT_API_ENDPOINT, params=params, timeout=10) if response.status_code == 200: response_data = response.text if '0' in response_data and 'yes' in response_data: return True except Exception as e: print(f"Error checking domain availability with Dynadot: {e}") return False def register_domain_name_dynadot(domain_name): try: params = { 'key': DYNADOT_API_KEY, 'command': 'register', 'domain': domain_name, 'duration': 1, # Number of years to register 'currency': 'USD', # Currency type 'coupon': 'NEWCOM24' # coupon # Add other required parameters for Dynadot here based on the example request } response = requests.get(DYNADOT_API_ENDPOINT, params=params, timeout=10) if response.status_code == 200: response_data = response.text if '0' in response_data: return True except Exception as e: print(f"Error in Dynadot registration: {e}") return False def log_message(domain_name): current_time = datetime.now().strftime("%m/%d/%Y %I:%M:%S %p") with open("log.txt", "a") as log_file: log_file.write(f"{domain_name} was successfully registered, on {current_time}\n") def main(): try_count = 1 while True: print(f"Try number {try_count}:") for domain_name in DOMAIN_LIST: try: if check_domain_availability_dynadot(domain_name): print(f"{domain_name} is available. Attempting registration with Dynadot...") if register_domain_name_dynadot(domain_name): print(f"Domain registration successful with Dynadot: {domain_name}.") log_message(domain_name) else: print(f"Failed to register domain with Dynadot: {domain_name}.") else: print(f"{domain_name} not yet available with Dynadot. Skipping...") except Exception as e: print(f"Error: {e}.") print("All domains in the list have been attempted.") print(f"Waiting 2 seconds before starting next try...") time.sleep(2) # Wait 2 seconds before starting another cycle of trying try_count += 1 if __name__ == "__main__": main()