Edit File: dns_common_lexicon.cpython-36.pyc
3 گa; � @ s d Z ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z dd lm Z dd lmZ ddl mZ yddlmZ dd lmZ W n ek r� dZdZY nX eje�ZG dd� d�Zeeeef eeef eeeeef f d�dd�ZdS )z;Common code for DNS Authenticator Plugins built on Lexicon.� N)�Any)�Dict)�Mapping)�Optional)�Union)� HTTPError)�RequestException)�errors)� dns_common)�ConfigResolver)�Providerc @ s� e Zd ZdZdd�dd�Zeeedd�dd�Zeeedd�d d �Zedd�dd �Ze ee jd�dd�Ze eee j d�dd�ZdS )� LexiconClientzI Encapsulates all communication with a DNS provider via Lexicon. N)�returnc C s | d S )N� )�selfr r �(/usr/lib/python3.6/dns_common_lexicon.py�__init__# s zLexiconClient.__init__)�domain�record_name�record_contentr c C sh | j |� y| jjd||d� W nB tk rb } z&tjd|dd� tjdj|���W Y dd}~X nX dS )a� Add a TXT record using the supplied information. :param str domain: The domain to use to look up the managed zone. :param str record_name: The record name (typically beginning with '_acme-challenge.'). :param str record_content: The record content (typically the challenge validation). :raises errors.PluginError: if an error occurs communicating with the DNS Provider API �TXT)�rtype�name�contentz'Encountered error adding TXT record: %sT)�exc_infozError adding TXT record: {0}N) �_find_domain_id�providerZ create_recordr �logger�debugr �PluginError�format)r r r r �er r r �add_txt_record&