示例#1
0
 def __init__(self, hostname, key, url=None, **kwargs):
     self.theip = None
     self._recordname, _, self._domain = hostname.partition(".")
     self.handler = DNSimple(domain=self._domain, domain_token=key)
     if url is not None:
         # The url must be a format string like this:
         #      'https://dnsimple.com/domains/%s/records'
         self.handler._baseurl = url % self._domain
示例#2
0
 def __init__(self, hostname, key, url=None, **kwargs):
     self.theip = None
     self._recordname, _, self._domain = hostname.partition(".")
     self.handler = DNSimple(domain=self._domain,
                             domain_token=key)
     if url is not None:
         # The url must be a format string like this:
         #      'https://dnsimple.com/domains/%s/records'
         self.handler._baseurl = url % self._domain
示例#3
0
class UpdateProtocolDnsimple(object):
    """Protocol handler for https://dnsimple.com/"""
    def __init__(self, hostname, key, url=None, **kwargs):
        self.theip = None
        self._recordname, _, self._domain = hostname.partition(".")
        self.handler = DNSimple(domain=self._domain, domain_token=key)
        if url is not None:
            # The url must be a format string like this:
            #      'https://dnsimple.com/domains/%s/records'
            self.handler._baseurl = url % self._domain

    @staticmethod
    def configuration_key():
        return "dnsimple"

    def update(self, ip):
        self.theip = ip
        return self.protocol()

    def protocol(self):
        return self.handler.update_record(name=self._recordname,
                                          address=self.theip)
示例#4
0
class UpdateProtocolDnsimple(UpdateProtocol):
    """Protocol handler for https://dnsimple.com/"""

    def __init__(self, hostname, key, url=None, **kwargs):
        self.theip = None
        self._recordname, _, self._domain = hostname.partition(".")
        self.handler = DNSimple(domain=self._domain,
                                domain_token=key)
        if url is not None:
            # The url must be a format string like this:
            #      'https://dnsimple.com/domains/%s/records'
            self.handler._baseurl = url % self._domain

    @staticmethod
    def configuration_key():
        return "dnsimple"

    def update(self, ip):
        self.theip = ip
        return self.protocol()

    def protocol(self):
        return self.handler.update_record(name=self._recordname,
                                          address=self.theip)