怎样安装Python-EPP

2018年7月29日 | 分类: 【技术】

参考:https://amon.org/python-epp
参考:https://amon.org/eppy

【介绍】

Python-EPP provides an interface to the Extensible Provisioning Protocol (EPP), which is being used for communication between domain name registries and domain name registrars.

EPP client written in Python. Development is still in an early phase, but most of this should actually work. Tested against the Dutch SIDN DRS5 interface.

官网:https://pypi.org/project/Python-EPP/
源码:https://github.com/jochem/Python-EPP

作者:Jochem Oosterveen
家乡:Amsterdam, NL

【安装】

wget https://github.com/jochem/Python-EPP/archive/master.zip && unzip master && cd Python-EPP-master
python setup.py build
python setup.py install

输出:

running install
...
Processing Python_EPP-0.1.0-py2.7.egg
Copying Python_EPP-0.1.0-py2.7.egg to /usr/local/lib/python2.7/site-packages
Adding Python-EPP 0.1.0 to easy-install.pth file

Installed /usr/local/lib/python2.7/site-packages/Python_EPP-0.1.0-py2.7.egg
Processing dependencies for Python-EPP==0.1.0
Searching for BeautifulSoup==3.2.1
Best match: BeautifulSoup 3.2.1
Adding BeautifulSoup 3.2.1 to easy-install.pth file

Using /usr/local/lib/python2.7/site-packages
Finished processing dependencies for Python-EPP==0.1.0

【使用】

from EPP import EPP, Contact, Domain, Nameserver

config = {
    'host': '%s.domain-registry.nl' % ('testdrs' if args['test'] else 'drs'),
    'port': 700,
    'user': <user>,
    'pass': <pass>,
}
contacts = {
    'registrant': 'NEX001077-NEXTG',
    'admin': 'FJF000131-NEXTG',
    'tech': 'JOO011933-NEXTG',
}
ns = ['ns.nextgear.nl', 'ns2.nextgear.nl']

""" This wil automatically handle the greeting and login """
epp = EPP(**config)

""" Get the token for a given domain """
domain = Domain(epp, 'nextgear.nl')
print domain.token()

""" Lookup the IP for a given nameserver """
ns = Nameserver(epp, ns[0])
print ns.get_ip()

""" Get contact information for a given handle """
contact = Contact(epp, 'JOO011933-NEXTG')
print contact.info()