| Current Path : /opt/cpanel/ |
| Current File : //opt/cpanel/test.py |
from pyepp import EppCommunicator
from pyepp.domain import Domain
# Configure EPP server connection details
config = {
"server": "epp.zarc.net.za", # Replace with your EPP server address
"port": "700",
# "client_cert": "/PATH/TO/YOUR/CLIENT_CERTIFICATE.crt", # Uncomment if certificate-based authentication is required
# "client_key": "/PATH/TO/YOUR/CLIENT_KEY.pem" # Uncomment if certificate-based authentication is required
}
# Create an EppCommunicator instance
epp = EppCommunicator(**config)
try:
# Establish connection to the EPP server
connect = epp.connect()
print("Connected to EPP server.")
# Log in to the EPP server
login = epp.login("enetworks", "36ancerg9a2") # Replace with your EPP credentials
print("Logged in successfully.")
# Send a hello request and receive greeting
hello = epp.hello()
print("Received greeting:", hello)
# Perform a domain check
domain_name = "enetworks.co.za"
domain_check = Domain(epp).check([domain_name])
print(f"Domain check for '{domain_name}': {domain_check}")
except Exception as e:
print(f"An error occurred: {e}")
finally:
# Close the EPP connection
if epp.is_connected():
epp.logout()
epp.disconnect()
print("Disconnected from EPP server.")