# Path: dyndnsc/updater/base.py
# class UpdateProtocol(Subject, DynamicCliMixin):
#     """Base class for all update protocols that use a simple http GET protocol."""
# 
#     theip = None
#     __hostname = None  # private place to store the property 'hostname'
#     configuration_key = None
# 
#     @property
#     def hostname(self):
#         """
#         Return the hostname managed by this updater.
# 
#         May be implemented or overwritten in updater subclasses.
#         """
#         return self.__hostname
# 
#     @hostname.setter
#     def hostname(self, value):
#         """
#         Set the hostname managed by this updater.
# 
#         May be implemented or overwritten in updater subclasses.
#         """
#         self.__hostname = value
# 
#     @staticmethod
#     def configuration_key_prefix():
#         """
#         Return a human readable string classifying this class as an updater.
# 
#         Should not be be implemented or overwritten in updater subclasses.
#         """
#         return "updater"
# 
#     def update(self, ip):
#         """
#         Update the hostname on the remote service.
# 
#         Abstract method, must be implemented in subclass.
#         """
#         raise NotImplementedError("Please implement in subclass")
# 
# Path: dyndnsc/common/six.py
# def ipaddress(addr):
#     """Return an ipaddress.ip_address object from the given string IP."""
#     return _ipaddress.ip_address(addr)
# 
# Path: dyndnsc/common/constants.py
# REQUEST_HEADERS_DEFAULT = {
#     # dyndns2 standard requires that we set our own user agent:
#     "User-Agent": "python-dyndnsc/%s" % __version__,
# }


import logging
import hashlib
import re
import requests
    import sys
from collections import namedtuple
from .base import UpdateProtocol
from ..common.six import ipaddress
from ..common import constants
                                       password.encode("ascii")))).hexdigest()
    return hashlib.sha1("|".join((userid, password))).hexdigest()  # noqa: S303


def records(credentials, url="https://freedns.afraid.org/api/"):
    """
    Yield the dynamic DNS records associated with this account.

    :param credentials: an AfraidCredentials instance
    :param url: the service URL
    """
    params = {"action": "getdyndns", "sha": credentials.sha}
    req = requests.get(
        url, params=params, headers=constants.REQUEST_HEADERS_DEFAULT, timeout=60)
    for record_line in (line.strip() for line in req.text.splitlines()
                        if len(line.strip()) > 0):
        yield AfraidDynDNSRecord(*record_line.split("|"))


def update(url):
    """
    Update remote DNS record by requesting its special endpoint URL.

    This automatically picks the IP address using the HTTP connection: it is not
    possible to specify the IP address explicitly.

    :param url: URL to retrieve for triggering the update
    :return: IP address
    """
    req = requests.get(

# Path: dyndnsc/updater/base.py
# class UpdateProtocol(Subject, DynamicCliMixin):
#     """Base class for all update protocols that use a simple http GET protocol."""
# 
#     theip = None
#     __hostname = None  # private place to store the property 'hostname'
#     configuration_key = None
# 
#     @property
#     def hostname(self):
#         """
#         Return the hostname managed by this updater.
# 
#         May be implemented or overwritten in updater subclasses.
#         """
#         return self.__hostname
# 
#     @hostname.setter
#     def hostname(self, value):
#         """
#         Set the hostname managed by this updater.
# 
#         May be implemented or overwritten in updater subclasses.
#         """
#         self.__hostname = value
# 
#     @staticmethod
#     def configuration_key_prefix():
#         """
#         Return a human readable string classifying this class as an updater.
# 
#         Should not be be implemented or overwritten in updater subclasses.
#         """
#         return "updater"
# 
#     def update(self, ip):
#         """
#         Update the hostname on the remote service.
# 
#         Abstract method, must be implemented in subclass.
#         """
#         raise NotImplementedError("Please implement in subclass")
# 
# Path: dyndnsc/common/six.py
# def ipaddress(addr):
#     """Return an ipaddress.ip_address object from the given string IP."""
#     return _ipaddress.ip_address(addr)
# 
# Path: dyndnsc/common/constants.py
# REQUEST_HEADERS_DEFAULT = {
#     # dyndns2 standard requires that we set our own user agent:
#     "User-Agent": "python-dyndnsc/%s" % __version__,
# }


# Path: dyndnsc/updater/afraid.py
import logging
import hashlib
import re
import requests
    import sys
from collections import namedtuple
from .base import UpdateProtocol
from ..common.six import ipaddress
from ..common import constants

                                       password.encode("ascii")))).hexdigest()
    return hashlib.sha1("|".join((userid, password))).hexdigest()  # noqa: S303


def records(credentials, url="https://freedns.afraid.org/api/"):
    """
    Yield the dynamic DNS records associated with this account.

    :param credentials: an AfraidCredentials instance
    :param url: the service URL
    """
    params = {"action": "getdyndns", "sha": credentials.sha}
    req = requests.get(
        url, params=params, headers=constants.REQUEST_HEADERS_DEFAULT, timeout=60)
    for record_line in (line.strip() for line in req.text.splitlines()
                        if len(line.strip()) > 0):
        yield AfraidDynDNSRecord(*record_line.split("|"))


def update(url):
    """
    Update remote DNS record by requesting its special endpoint URL.

    This automatically picks the IP address using the HTTP connection: it is not
    possible to specify the IP address explicitly.

    :param url: URL to retrieve for triggering the update
    :return: IP address
    """
    req = requests.get(

        url, headers=constants.REQUEST_HEADERS_DEFAULT, timeout=60)