API

Submodules

pyepp.base_command module

Base command

class pyepp.base_command.BaseCommand(epp_communicator: EppCommunicator)[source]

Bases: object

Base command class. Other EPP commands will inherit this class.

PARAMS = ()
execute(xml_command: str, **kwargs) EppResultData[source]

This receives an EPP XML command and the arguments and send to the EPP server to be executed.

Parameters:
  • xml_command – XML command

  • kwargs – Keyword arguments

Returns:

Response Object

exception pyepp.base_command.ErrorCodeInResultException[source]

Bases: Exception

Error code in result exception

pyepp.command_templates module

EPP XML command templates

pyepp.contact module

Contact Mapping Module. This module is used to manage contact objects in Registry.

class pyepp.contact.AddressData(street_1: str | None = '', city: str | None = '', country_code: str | None = '', street_2: str | None = '', street_3: str | None = '', province: str | None = '', postal_code: str | None = '')[source]

Bases: object

Contact address data class.

city: str | None = ''
country_code: str | None = ''
postal_code: str | None = ''
province: str | None = ''
street_1: str | None = ''
street_2: str | None = ''
street_3: str | None = ''
class pyepp.contact.Contact(epp_communicator: EppCommunicator)[source]

Bases: BaseCommand

Epp Contact object class. This class is used to create and manage the contacts within the Registry.

Contacts are individuals or organizations that are associated with domain names. There are different types of contacts including:

  • Registrant - The entity that has the authority to use and manage the domain name.

  • Administrative Contact - Either the Registrant or someone authorized to act on behalf of the Registrant.

  • Technical Contact - A technical contact is an individual identified as a contact for technical information-related administration of a registered domain name.

  • Billing Contact - Also known as the Finance Contact, this is the individual or organization responsible for

payment of fees related to the domain name and will monitor period activity, account balances, and account status.

check(contact_ids: list[str], client_transaction_id: str | None = None) EppResultData[source]

A successful Contact Check request determines whether a Contact ID is available for use and whether a contact can be created in the Registry. When creating a new contact, the Registrar must generate a Registry-unique contact ID. A Registry Contact Check request can determine whether an ID is already in use.

Parameters:
  • contact_ids – List of contact ids

  • client_transaction_id – Client transaction id

Returns:

contact check result

Return type:

EppResultData

create(contact: ContactData, client_transaction_id: str | None = None) EppResultData[source]

A successful Contact Create request creates a contact object in the Registry. To create a domain name successfully, a Registrar does not need to be the sponsor of the related hosts but must be the sponsor of all assigned contacts.

Parameters:
  • contact – Contact

  • client_transaction_id – Client transaction id

Returns:

Result object

Return type:

EppResultData

delete(contact_id: str, client_transaction_id: str | None = None) EppResultData[source]

A successful Contact Delete request deletes a contact object from the Registry

Parameters:
  • contact_id – Contact ID

  • client_transaction_id – Client transaction id

Returns:

Result object

info(contact_id: str, client_transaction_id: str | None = None) EppResultData[source]

A successful Contact Info request retrieves information associated with an existing contact. All available information is returned if the querying Registrar is the contact’s sponsor. For a non-sponsoring Registrar, all contact information is returned if the correct authorization code is entered. As well, if the Authorization Code Expiry has been configured, the authorization code must not be expired. Otherwise, the <contact:info> will fail.

Parameters:
  • contact_id – Contact ID

  • client_transaction_id – Client transaction id

Returns:

Contact details

Return type:

EppResultData

update(contact: ContactData, add_status: str | None = '', remove_status: str | None = '', client_transaction_id: str | None = None) EppResultData[source]

A successful Contact Update request modifies a contact object in the Registry. Updates to Registrant contacts must be valid and must be complete.

Parameters:
  • contact – Contact details to be updated

  • add_status – Status to be added

  • remove_status – Status to be removed

  • client_transaction_id – Client transaction id

Returns:

Result object

Return type:

EppResultData

class pyepp.contact.ContactData(id: str, email: str | None = '', postal_info: PostalInfoData | None = None, status: list[str] | None = None, phone: str | None = '', fax: str | None = '', password: str | None = '', create_date: str | None = '', creat_client_id: str | None = '', sponsoring_client_id: str | None = '', update_client_id: str | None = '', update_date: str | None = '')[source]

Bases: object

Contact data class. Contains the properties of the contacts associated with the domain name.

creat_client_id: str | None = ''
create_date: str | None = ''
email: str | None = ''
fax: str | None = ''
id: str
password: str | None = ''
phone: str | None = ''
postal_info: PostalInfoData | None = None
sponsoring_client_id: str | None = ''
status: list[str] | None = None
update_client_id: str | None = ''
update_date: str | None = ''
class pyepp.contact.PostalInfoData(name: str | None, organization: str | None = '', address: AddressData | None = None)[source]

Bases: object

Contact postal info data class.

address: AddressData | None = None
name: str | None
organization: str | None = ''

pyepp.domain module

Domain Mapping Module.

class pyepp.domain.DNSKeyFlagEnum(value)[source]

Bases: Enum

DNS Key flags enumeration.

FLAG_256 = 256
FLAG_257 = 257
class pyepp.domain.DNSSECAlgorithm(value)[source]

Bases: Enum

DNSSEC algorithms enumeration.

DSA_NSEC3_SHA1 = 6
DSA_SHA_1 = 3
ECDSA_CURVE_P_256_WITH_SHA_256 = 13
ECDSA_CURVE_P_384_WITH_SHA_384 = 14
ED25519 = 15
ED448 = 16
GOST_R_34_10_2001 = 12
PRIVATE_ALGORITHM = 253
PRIVATE_ALGORITHM_OID = 255
RSASHA1_NSEC3_SHA1 = 7
RSA_SHA_1 = 5
RSA_SHA_256 = 8
RSA_SHA_512 = 10
class pyepp.domain.DSRecordData(key_tag: int, algorithm: DNSSECAlgorithm, digest_type: DigestTypeEnum, digest: str, dns_key: DSRecordKeyData | None = None)[source]

Bases: object

DNSSEC dataclass.

algorithm: DNSSECAlgorithm
digest: str
digest_type: DigestTypeEnum
dns_key: DSRecordKeyData | None = None
key_tag: int
class pyepp.domain.DSRecordKeyData(flag: str, algorithm: DNSSECAlgorithm, public_key: str, protocol: str = 3)[source]

Bases: object

DNSSEC Key data enumeration.

algorithm: DNSSECAlgorithm
flag: str
protocol: str = 3
public_key: str
class pyepp.domain.DigestTypeEnum(value)[source]

Bases: Enum

Digest types enumeration.

GOST_R_34_11_94 = 3
SHA_1 = 1
SHA_256 = 2
SHA_384 = 4
class pyepp.domain.Domain(epp_communicator: EppCommunicator)[source]

Bases: BaseCommand

Epp domain object class is used to create and manage domain names in Registry.

check(domain_names: list[str], client_transaction_id: str | None = None) EppResultData[source]

A successful Domain Check request determines whether a domain name is available for use and whether a domain name registration can be successfully created in the Registry.

Parameters:
  • domain_names (list) – List of domain names

  • client_transaction_id – Client transaction id

Returns:

Result object

Return type:

EppResultData

create(domain: DomainData, client_transaction_id: str | None = None) EppResultData[source]

A successful Domain Create request creates a domain object in the Registry, and also creates relationships between the domain name and previously created contacts and hosts.

Parameters:
  • domain – Domain name details

  • client_transaction_id – Client transaction id

Returns:

Result object

Return type:

EppResultData

delete(domain_name: str, client_transaction_id: str | None = None) EppResultData[source]

This command provides a transform operation that allows a client to delete a domain object

Parameters:
  • domain_name – Domain Name

  • client_transaction_id – Client transaction id

Returns:

Result object

Return type:

EppResultData

info(domain_name: str, client_transaction_id: str | None = None) EppResultData[source]

A successful Domain Info request retrieves information associated with an existing domain name.

Parameters:
  • domain_name – Domain name

  • client_transaction_id – Client transaction id

Returns:

Result object

Return type:

EppResultData

renew(domain_name: str, expiry_date: date, period: int | None = 1, client_transaction_id: str | None = None) EppResultData[source]

A successful Domain Renew request extends the registration period of a domain name.

Parameters:
  • domain_name – Domain Name

  • expiry_date – expiry date

  • period – period

  • client_transaction_id – Client transaction id

Returns:

Result object

Return type:

EppResultData

transfer(domain_name: str, password: str, period: int | None = None, client_transaction_id: str | None = None) EppResultData[source]

transfers the sponsorship of a domain name from another Registrar to the Registrar submitting the request.

Parameters:
  • domain_name – Domain Name

  • password – The authorization password for the domain object

  • period – period

  • client_transaction_id – Client transaction id

Returns:

Result object

Return type:

EppResultData

update(domain_name: str, registrant: str | None = None, password: str | None = None, add_admins: list[str] | None = None, remove_admins: list[str] | None = None, add_techs: list[str] | None = None, remove_techs: list[str] | None = None, add_billings: list[str] | None = None, remove_billings: list[str] | None = None, add_statues: list[tuple] | None = None, remove_statues: list[str] | None = None, add_hosts: list[str] | None = None, remove_hosts: list[str] | None = None, client_transaction_id: str | None = None) EppResultData[source]

A successful Domain Update request modifies a domain object in the Registry, and may also add or delete relationships between the domain name and previously created hosts and contacts.

Parameters:
  • domain_name – Domain name to be updated

  • registrant – A contact id to replace the current registrant

  • add_admins – A list of contact ids to be added to the admin contacts

  • remove_admins – A list of contact ids to be removed from the admin contacts

  • add_techs – A list of contact ids to be added to the techs contacts

  • remove_techs – A list of contact ids to be removed from the tech contacts

  • add_billings – A list of contact ids to add to the billing contacts

  • remove_billings – A list of contact ids to remove from the billing contacts

  • add_statues – List of statuses to be added to the domain name. The tuple must contain two elements. The first one will be the Status Code and the second element will be Descriptions.

  • remove_statues – A list of statues to be removed from the domain name.

  • add_hosts – A list of host names to be added to the domain name.

  • remove_hosts – A list of host names to be removed from the domain name.

  • password – A new password to replace the old password.

  • client_transaction_id – Client transaction id

Returns:

Result object

Return type:

EppResultData

class pyepp.domain.DomainData(domain_name: str, period: int | None = None, registrant: str | None = '', admin: str | None = '', tech: str | None = '', sponsoring_client_id: str | None = '', billing: str | None = '', status: list[str] | None = None, host: list[str] | None = None, create_date: str | None = '', creat_client_id: str | None = '', update_client_id: str | None = '', update_date: str | None = '', expiry_date: str | None = '', transfer_date: str | None = '', password: str | None = '', dns_sec: list[pyepp.domain.DSRecordData] | None = None)[source]

Bases: object

Domain name dataclass.

admin: str | None = ''
billing: str | None = ''
creat_client_id: str | None = ''
create_date: str | None = ''
dns_sec: list[pyepp.domain.DSRecordData] | None = None
domain_name: str
expiry_date: str | None = ''
host: list[str] | None = None
password: str | None = ''
period: int | None = None
registrant: str | None = ''
sponsoring_client_id: str | None = ''
status: list[str] | None = None
tech: str | None = ''
transfer_date: str | None = ''
update_client_id: str | None = ''
update_date: str | None = ''

pyepp.epp module

EPP Communicator Module

class pyepp.epp.EppCommunicator(server: str, port: str, client_cert: str, client_key: str, dry_run: bool | None = False)[source]

Bases: object

An EPP client for connecting to EPP server.

connect() bytes[source]

Initial connect to the server.

Returns:

Greeting message

Return type:

bytes

Raises:

EppCommunicatorException – When there is any errors

execute(cmd: str) EppResultData[source]

Execute the command. Sending the request to the server and receive the response.

Parameters:

cmd (str) – XML Command

Returns:

Result object

Return type:

EppResultData

Raises:

EppCommunicatorException – When there is any errors.

hello() bytes[source]

Send Hello command the server.

Returns:

Greeting response

Return type:

bytes

login(user: str, password: str, extensions: list[str] | None = None) EppResultData[source]

Login the user to EPP server.

Parameters:
  • user – username

  • password – password

  • extensions – A list of supported extension URIs

Returns:

Result object

Return type:

EppResultData

Raises:

EppCommunicatorException – When there are any errors.

logout() EppResultData[source]

Logout the user from EPP server.

Returns:

Result object

Return type:

EppResultData

property user

User property

exception pyepp.epp.EppCommunicatorException[source]

Bases: Exception

EPP communicator exception.

class pyepp.epp.EppResultCode(value)[source]

Bases: Enum

EPP result codes enumeration.

PARAMETER_RANGE_ERROR = 2004
SUCCESS = 1000
SUCCESS_ACK_TO_DEQUEUE = 1301
SUCCESS_ACTION_PENDING = 1001
SUCCESS_END_SESSION = 1500
SUCCESS_NO_MESSAGE = 1300
class pyepp.epp.EppResultData(code: int, message: str, raw_response: str, result_data: Any, reason: str | None = None, client_transaction_id: str | None = None, server_transaction_id: str | None = None, repository_object_id: str | None = None)[source]

Bases: object

Epp result data structure.

client_transaction_id: str | None = None
code: int
message: str
raw_response: str
reason: str | None = None
repository_object_id: str | None = None
result_data: Any
server_transaction_id: str | None = None
to_dict() dict[source]

Convert an EppResultData object to a dictionary.

pyepp.epp.get_format_32() str[source]

Get the size of C integers. We need 32 bits unsigned.

From http://www.bortzmeyer.org/4934.html

pyepp.helper module

Helper functions

pyepp.helper.generate_password(length: int) str[source]

Generate a random password including letters and digits.

Parameters:

length (int) – password length

Returns:

password

Return type:

str

pyepp.helper.xml_pretty(bxml: bytes) str[source]

Convert bytes xml to string and prettify it.

Parameters:

bxml – xml content

Returns:

xml in string

pyepp.host module

Host Mapping Module. This module is used to manage host objects in Registry. A host object represents a Domain Name System (DNS) server that resolves domain names into IP addresses.

class pyepp.host.Host(epp_communicator: EppCommunicator)[source]

Bases: BaseCommand

Epp Host object class. This class is used to create and manage host objects in Registry.

An EPP host object has attributes and associated values that can be viewed and modified by the sponsoring Registrar. When you create or update a host, you must follow the rules that ensure that the domain name can still be resolved even if there is an outage of any individual host or network. This means that two or more unique name servers must be defined for each protocol in use. Although you can use the IPv4 and IPv6 protocols concurrently, they are not interchangeable or compatible. As a result, to use both protocols requires that you must provide data for two unique name servers that are accessible by IPv4 and two unique name servers that are accessible by IPv6.

check(host_names: list[str], client_transaction_id: str | None = None) EppResultData[source]

A successful Host Check request determines whether a host is available for use and whether a host can be created in the Registry. A single request can check from 1 to 15 host names.

Parameters:
  • host_names – List of domain names

  • client_transaction_id – Client transaction id

Returns:

Result object

Return type:

EppResultData

create(host: HostData, client_transaction_id: str | None = None) EppResultData[source]

A successful Host Create request creates a host object identified by its name in the Registry.

Parameters:
  • host – Contact

  • client_transaction_id – Client transaction id

Returns:

Result object

Return type:

EppResultData

delete(host_name: str, client_transaction_id: str | None = None) EppResultData[source]

A successful Host Delete request deletes a host object. Warning: A host object cannot be deleted while it is associated with a domain object.

Parameters:
  • host_name – Host Name

  • client_transaction_id – Client transaction id

Returns:

Result object

Return type:

EppResultData

info(host_name: str, client_transaction_id: str | None = None) EppResultData[source]

A successful Host Info request retrieves detailed host information.

Parameters:
  • host_name – Host name

  • client_transaction_id – Client transaction id

Returns:

Result object

Return type:

EppResultData

update(host_name: str, add_ip_address: list[pyepp.host.IPAddressData] | None = None, remove_ip_address: list[pyepp.host.IPAddressData] | None = None, add_status: list[str] | None = None, remove_status: list[str] | None = None, new_host_name: str | None = None, client_transaction_id: str | None = None) EppResultData[source]

The EPP <update> command provides a transform operation that allows a client to modify the attributes of a host object.

Parameters:
  • host_name – Host Name

  • add_ip_address – A list of IP addressed to be added to the host

  • remove_ip_address – A list of IP addressed to be removed from the host

  • add_status – A list of status to be added to the host

  • remove_status – A list of status to be removed from host

  • new_host_name – The host name will be changed to this new host name

  • client_transaction_id – Client transaction id

Returns:

Result object

Return type:

EppResultData

class pyepp.host.HostData(host_name: str, address: list[pyepp.host.IPAddressData] | None = None, status: list[str] | None = None, create_date: str | None = '', creat_client_id: str | None = '', update_client_id: str | None = '', update_date: str | None = '')[source]

Bases: object

Host object data class.

address: list[pyepp.host.IPAddressData] | None = None
creat_client_id: str | None = ''
create_date: str | None = ''
host_name: str
status: list[str] | None = None
update_client_id: str | None = ''
update_date: str | None = ''
class pyepp.host.IPAddressData(address: str, ip: str)[source]

Bases: object

IP Address data class.

address: str
ip: str