Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
build/
dist/
*.pyc
*.pyo
*.egg-info
3 changes: 2 additions & 1 deletion README.md
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,13 +8,14 @@ EPP client written in Python. Development is still in an early phase, but most o
Usage
-----

from EPP import EPP, Contact, Domain, Nameserver
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>,
'cert': <path/to/certificate/file.pem>, # Optional parameter
}
contacts = {
'registrant': 'NEX001077-NEXTG',
Expand Down
245 changes: 0 additions & 245 deletions epp/EPP.py

This file was deleted.

6 changes: 6 additions & 0 deletions epp/__init__.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-

from .contact import Contact
from .domain import Domain
from .epp import EPP
from .nameserver import Nameserver
4 changes: 2 additions & 2 deletions epp/commands/__init__.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,7 @@
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
<command>
<create>
<domain:create
<domain:create
xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<domain:name>%(domain)s</domain:name>
<domain:ns>
Expand All@@ -35,7 +35,7 @@
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
<extension>
<sidn-ext-epp:command
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sidn-ext-epp="http://rxsd.domain-registry.nl/sidn-ext-epp-1.0">
<sidn-ext-epp:domainCancelDelete>
<sidn-ext-epp:name>%s</sidn-ext-epp:name>
Expand Down
8 changes: 4 additions & 4 deletions epp/commands/contact.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,7 @@
<contact:check
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
<contact:id>%(handle)s</contact:id>
</contact:check>
</contact:check>
</check>
<clTRID>ABC-12345</clTRID>
</command>
Expand All@@ -28,7 +28,7 @@
<contact:pc>%(pc)s</contact:pc>
<contact:cc>%(cc)s</contact:cc>
</contact:addr>
</contact:postalInfo>
</contact:postalInfo>
<contact:voice>%(voice)s</contact:voice>
<contact:fax>%(fax)s</contact:fax>
<contact:email>%(email)s</contact:email>
Expand DownExpand Up@@ -85,9 +85,9 @@
<contact:voice>%(voice)s</contact:voice>
<contact:fax>%(fax)s</contact:fax>
<contact:email>%(email)s</contact:email>
</contact:chg>
</contact:chg>
</contact:update>
</update>
<clTRID>ABC-12345</clTRID>
</command>
</epp>"""
</epp>"""
64 changes: 64 additions & 0 deletions epp/contact.py
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
# -*- coding: utf-8 -*-

from . import commands
from .epp import EPPObject


class Contact(EPPObject):

def __init__(self, epp, handle=False, **kwargs):
self.epp = epp
self.handle = handle

for k, v in kwargs.items():
setattr(self, k, v)

def __unicode__(self):
try:
self.name != ''
return ("[%(handle)s] %(name)s, %(street)s, " +
"%(pc)s %(city)s (%(cc)s)") % self
except:
return self.handle

def available(self):
cmd = commands.contact.available % self
res = self.epp.cmd(cmd)

return res.resdata.find('contact:id').get('avail') == 'true'

def create(self):
cmd = commands.contact.create % self
res = self.epp.cmd(cmd).resdata

return res.find('contact:id').text

def info(self):
cmd = commands.contact.info % self
res = self.epp.cmd(cmd).resdata
self.roid = res.find('contact:roid').text
self.status = res.find('contact:status').get('s')
self.name = res.find('contact:name').text

try:
self.street = res.find('contact:street').text
except AttributeError:
pass

self.city = res.find('contact:city').text

try:
self.pc = res.find('contact:pc').text
except AttributeError:
pass

self.cc = res.find('contact:cc').text
self.voice = res.find('contact:voice').text
self.email = res.find('contact:email').text

return self

def update(self):
cmd = commands.contact.update % self

return self.epp.cmd(cmd)
Loading