Skip to main content

PyEPP

A Python API on top of the EPP protocol and an EPP CLI client to work easier with registry systems.

This is a Python API on EPP protocol to connect to any registry systems that support EPP and work with it. Also, it is a CLI client to interact with the registry systems. It supports bellow RFCs:

Installation

pip install pyepp

Usage example

from datetime import date

from pyepp import EppCommunicator
from pyepp.domain import Domain, DomainData, DSRecordData, DNSSECAlgorithm, DigestTypeEnum
from pyepp.contact import Contact, ContactData, PostalInfoData, AddressData

# client_cert and client_key may be omitted where
# a registry does not require certificate based authentication
config = {
    "server": "epp.test.net.nz",
    "port": "700",
    "client_cert": "/PATH/TO/YOUR/CLIENT_CERTIFICATE.crt",
    "client_key": "/PATH/TO/YOUR/CLIENT_KEY.pem"
}

epp = EppCommunicator(**config)

connect = epp.connect()
login = epp.login("user_name", "password")
# Sends a hello request and receive greeting in respond
hello = epp.hello()

contact = Contact(epp)

# Check contacts availability
contact_check = contact.check(['contact-1', 'contact-2'])

# Create a new contact
contact_create_params = ContactData(
    id='contact-1',
    email='epp@example.net.nz',
    postal_info=PostalInfoData(
        name='Registrar 1',
        organization='Registrar 1',
        address=AddressData(
            street_1='18 Registrar Street',
            street_2='Registrar CBD',
            city='Registrar',
            country_code='NZ',
            province='Registrar',
            postal_code='6011'
        ),
    ),
    phone='+64.111111111'
)
contact_create = contact.create(contact_create_params)

# Get contact details
contact_info = contact.info('contact-1')

domain = Domain(epp)
# Check domains availability
domain_check = domain.check(['domain1.nz', 'domain2.nz'])

# Create a new domain name
domain_create_params = DomainData(
    domain_name='example.nz',
    registrant='contact-1',
    admin='contact-1',
    tech='contact-1',
    billing='contact-3',
    period=3,
    host=['01y.test-indwrx2vkicn2otgm3otav5wpnzvjd.co.nz', '0d9x6239.example.co.nz'],
    dns_sec=DSRecordData(
        key_tag=1235,
        algorithm=DNSSECAlgorithm.DSA_SHA_1.value,
        digest_type=DigestTypeEnum.SHA_1.value,
        digest='8cdb09364147aed879d12c68d615f98af5900b73'
    ),
)
domain_create = domain.create(domain_create_params)

# Renew a domain name
renew_domain = domain.renew(domain_name='example-1.nz', expiry_date=date(2024, 2, 23), period=2)

PyEPP CLI

PyEPP also has a command line interface that allows the user to interact with the registry system.

Usage: pyepp [OPTIONS] COMMAND [ARGS]...

  A command line interface to work with PyEpp library.

Options:
  --server TEXT                   [required]
  --port TEXT                     [required]
  --user TEXT                     [required]
  --password TEXT                 [required]
  --client-cert TEXT
  --client-key TEXT
  --extension TEXT                The extension to be loaded for the EPP
                                  command.
  -o, --output-format [xml|object|min]
                                  [default: XML]
  --no-pretty
  --dry-run
  -f, --file FILENAME             If provided, the output will be written in
                                  the file.
  -v, --verbose
  -d, --debug
  --version                       Show the version and exit.
  -h, --help                      Show this message and exit.

Commands:
  contact  To work with Contact objects in the registry.
  domain   To work with Domain name objects in the registry.
  hello    Sends a hello command to the server and receives the Greeting...
  host     To work with Host objects in the registry.
  poll     To manage registry service messages.
  run      Receive an XML file containing an EPP XML command and execute it.

Enable shell autocomplete

To enable shell autocompletion for your shell follow the below commands:

Zsh

mkdir -p ~/.pyepp
_PYEPP_COMPLETE=zsh_source pyepp > ~/.pyepp/shell-complete.zsh

Source the file in ~/.zshrc.

. ~/.pyepp/shell-complete.zsh

Bash

mkdir -p ~/.pyepp
_PYEPP_COMPLETE=bash_source pyepp > ~/.pyepp/shell-complete.bash

Source the file in ~/.bashrc.

. ~/.pyepp/shell-complete.bash

Development setup

Clone this project. It's recommended to create virtual environment. Then install the dependencies and development dependencies:

pip install -r requirements.txt
pip install -r requirements.dev.txt

Before creating any pull requests please make sure your code lints and there is no security issues in your code by running below scripts:

./scripts/linter.sh
./scripts/code-security-check.sh

Happy developing!

Contributing

Please refer to CONTRIBUTING.md

Metadata

Release files for pyepp 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyepp 0.3.2
File Size Uploaded
pyepp-0.3.2.tar.gz 61.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyepp 0.3.2
File Interpreter ABI Platform
pyepp-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 107.7 kB

Release files / pyepp-0.3.2.tar.gz

Download URL pyepp-0.3.2.tar.gz
Size 61.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ff09a4d733942da599f497ae271f5e7cd449d135e8e51331c1a33ebb72e60cf2
BLAKE2b-256 checksum
How to use checksums
aa872eb3e1f8674de1ca640849c7b4ea3f7f438355d511753a3ec9d3df4ca2e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Release files / pyepp-0.3.2-py3-none-any.whl

Download URL pyepp-0.3.2-py3-none-any.whl
Size 46.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
997bd181d8c53fc4755972d5901d9e4dca650210742e5cb1a38c8961c22b2dce
BLAKE2b-256 checksum
How to use checksums
3feb039c3673a6401997d6d740f3be2f2062170df7454c890f7e7dfd85c139e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page