%PDF- %PDF-
| Direktori : /lib/python2.7/site-packages/salt/modules/ |
| Current File : //lib/python2.7/site-packages/salt/modules/namecheap_domains.pyc |
�
���^c @@ s� d Z d d l m Z m Z m Z e Z y d d l Z Wn e k
rQ e
Z n Xd d l m Z d � Z
d � Z d d � Z d � Z d � Z d
� Z d � Z d d d d d d � Z d S(
u]
Namecheap Domain Management
.. versionadded:: 2017.7.0
Prerequisites
-------------
This module uses the ``requests`` Python module to communicate to the namecheap
API.
Configuration
-------------
The Namecheap username, API key and URL should be set in the minion configuration
file, or in the Pillar data.
.. code-block:: yaml
namecheap.name: companyname
namecheap.key: a1b2c3d4e5f67a8b9c0d1e2f3
namecheap.client_ip: 162.155.30.172
#Real url
namecheap.url: https://api.namecheap.com/xml.response
#Sandbox url
#namecheap.url: https://api.sandbox.namecheap.xml.response
i ( t absolute_importt print_functiont unicode_literalsN( t sixc C@ s t r
d St S( uH
Check to make sure requests and xml are installed and requests
u namecheap_domains( t CAN_USE_NAMECHEAPt False( ( ( sB /usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pyt __virtual__* s c C@ sj t j j j d � } | | d <t j j j | � } | d k rD i S| j d � d } t j j j | � S( ua
Try to reactivate the expired domain name
Returns the following information:
- Whether or not the domain was reactivated successfully
- The amount charged for reactivation
- The order ID
- The transaction ID
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.reactivate my-domain-name
u namecheap.domains.reactivateu
DomainNameu DomainReactivateResulti N( t saltt utilst namecheapt get_optst post_requestt Nonet getElementsByTagNamet xml_to_dict( t domain_namet optst response_xmlt domainreactivateresult( ( sB /usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pyt
reactivate3 s
c C@ s� t j j j d � } | | d <| | d <| d k rB | | d <n t j j j | � } | d k rg i S| j d � d } t j j j | � S( u�
Try to renew the specified expiring domain name for a specified number of years
domain_name
The domain name to be renewed
years
Number of years to renew
Returns the following information:
- Whether or not the domain was renewed successfully
- The domain ID
- The order ID
- The transaction ID
- The amount charged for renewal
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.renew my-domain-name 5
u namecheap.domains.renewu
DomainNameu Yearsu
PromotionCodeu DomainRenewResulti N( R R R R
R R R
R ( R t yearst promotion_codeR R t domainrenewresult( ( sB /usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pyt renewP s
c p K@ s� d� } dq dr ds dt du dv dw dx dy dz d{ d| d} d~ d d� d� d� d� d� d� d� d� d� d� d� d� d� d� d� d� d� d� d� d� d� d� g% } t j j j d� � } | | d� <t j | � | d� <d� � } x|t j | � D]k\ } } | j d� � r
| | | | | d� d� d� d� d� g � n | j d� � rB| | | | | d� d� d� d� d� g � n | j d� � rz| | | | | d� d� d� d� d� g � n | j d� � r�| | | | | d� d� d� d� d� g � n | j d� � r�| | | | | d� d� d� d� d� g � n | d� k r'| | k r't j j j j d� � t
d� � � n | | | <q� WxO | D]G } | | k r<t j j j j d� | d� � t
d� | d� � � q<q<Wt j j j | � }
|
d� k r�i S|
j
d� � d� } t j j j | � S(� u0
Try to register the specified domain name
domain_name
The domain name to be registered
years
Number of years to register
Returns the following information:
- Whether or not the domain was renewed successfully
- Whether or not WhoisGuard is enabled
- Whether or not registration is instant
- The amount charged for registration
- The domain ID
- The order ID
- The transaction ID
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.create my-domain-name 2
u afru albu arau argu armu asmu astu aveu awau azeu baku balu banu baqu basu belu benu bhou bosu bulu buru caru catu cheu chiu chvu copu cosu czeu danu divu doiu dutu engu estu faou fiju finu freu fryu geou geru glau gleu gonu greu guju hebu hinu hunu incu indu inhu islu itau javu jpnu kasu kazu khmu kiru koru kuru laou lavu litu ltzu malu mkdu mltu molu monu mriu msau nepu noru oriu ossu panu peru polu poru pusu raju rumu rusu sanu scru sinu slou slvu smou sndu somu spau srdu srpu swau sweu syru tamu telu tgku thau tibu turu ukru urdu uzbu vieu welu yidu
AdminAddress1u AdminCityu AdminCountryu AdminEmailAddressu AdminFirstNameu
AdminLastNameu
AdminPhoneu AdminPostalCodeu AdminStateProvinceu AuxBillingAddress1u AuxBillingCityu AuxBillingCountryu AuxBillingEmailAddressu AuxBillingFirstNameu AuxBillingLastNameu AuxBillingPhoneu AuxBillingPostalCodeu AuxBillingStateProvinceu RegistrantAddress1u RegistrantCityu RegistrantCountryu RegistrantEmailAddressu RegistrantFirstNameu RegistrantLastNameu RegistrantPhoneu RegistrantPostalCodeu RegistrantStateProvinceu TechAddress1u TechCityu TechCountryu TechEmailAddressu
TechFirstNameu TechLastNameu TechPhoneu TechPostalCodeu TechStateProvinceu Yearsu namecheap.domains.createu
DomainNamec S@ s8 x1 | D]) } | | } | | k r | | | <q q Wd S( N( ( t opts_dictt kwargst valuet suffixt preficest prefixt nextkey( ( sB /usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pyt add_to_opts� s
u
Registranti
u Techu Adminu
AuxBillingu Billingi i i u IdnCodeu Invalid IdnCodeu Missing required parameter 'u 'u DomainCreateResulti (p u afru albu arau argu armu asmu astu aveu awau azeu baku balu banu baqu basu belu benu bhou bosu bulu buru caru catu cheu chiu chvu copu cosu czeu danu divu doiu dutu engu estu faou fiju finu freu fryu geou geru glau gleu gonu greu guju hebu hinu hunu incu indu inhu islu itau javu jpnu kasu kazu khmu kiru koru kuru laou lavu litu ltzu malu mkdu mltu molu monu mriu msau nepu noru oriu ossu panu peru polu poru pusu raju rumu rusu sanu scru sinu slou slvu smou sndu somu spau srdu srpu swau sweu syru tamu telu tgku thau tibu turu ukru urdu uzbu vieu welu yidN( R R R R
R t text_typet iteritemst
startswitht logt errort ExceptionR R R
t atts_to_dict( R R R t idn_codest require_optsR R t keyR t requiredkeyR t domainresult( ( sB /usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pyt createx sX
)))))
c G@ s� t j j j d � } d j | � | d <t j j j | � } | d k rM i Si } xN | j d � D]= } | j d � } t j j j | � | | j d � j
� <qc W| S( uT
Checks the availability of domains
domains_to_check
array of strings List of domains to check
Returns a dictionary mapping the each domain name to a boolean denoting
whether or not it is available.
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.check domain-to-check
u namecheap.domains.checku ,u
DomainListu DomainCheckResultu Availableu DomainN( R R R R
t joint get_requestR R
t getAttributet string_to_valuet lower( t domains_to_checkR R t domains_checkedt resultt available( ( sB /usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pyt check� s ,c C@ sj t j j j d � } | | d <t j j j | � } | d k rD g S| j d � d } t j j j | � S( u-
Returns information about the requested domain
returns a dictionary of information about the domain_name
domain_name
string Domain name to get information about
CLI Example:
.. code-block:: bash
salt 'my-minion' namecheap_domains.get_info my-domain-name
u namecheap.domains.getinfou
DomainNameu DomainGetInfoResulti N( R R R R
R. R R
R ( R R R t domaingetinforesult( ( sB /usr/lib/python2.7/site-packages/salt/modules/namecheap_domains.pyt get_info� s
c C@ s� t j j j t j j j d � � } | d k r4 g S| j d � d } g } x� | j d � D]� } t j j j | � } | j j | d <g } | j d � d } x3 | j d � D]"