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 ejeZG dd dZeeeef eeef eeeeef f dddZdS )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 ZdZddddZeeeddddZeeeddd d Zedddd Ze ee jdddZe eee j dddZdS ) 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__)domainrecord_namerecord_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)rtypenamecontentz'Encountered error adding TXT record: %sT)exc_infozError adding TXT record: {0}N) _find_domain_idproviderZ create_recordr loggerdebugr PluginErrorformat)r r r r er r r add_txt_record&