当前位置: 首页>>代码示例>>Python>>正文


Python modules.E类代码示例

本文整理汇总了Python中openprovider.modules.E的典型用法代码示例。如果您正苦于以下问题:Python E类的具体用法?Python E怎么用?Python E使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了E类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _domain

def _domain(domain):
    sld, tld = domain.split('.', 1)

    return E.domain(
        E.name(sld),
        E.extension(tld),
    )
开发者ID:AntagonistHQ,项目名称:openprovider.py,代码行数:7,代码来源:domain.py

示例2: request

    def request(self, tree, **kwargs):
        """
        Construct a new request with the given tree as its contents, then ship
        it to the OpenProvider API.
        """

        apirequest = lxml.etree.tostring(
            E.openXML(
                E.credentials(
                    E.username(self.username),
                    OE('password', self.password),
                    OE('hash', self.password_hash),
                ),
                tree
            ),

            method='c14n'
        )

        try:
            apiresponse = self.session.post(self.url, data=apirequest)
            apiresponse.raise_for_status()
        except requests.RequestException as e:
            raise ServiceUnavailable(str(e))

        tree = lxml.objectify.fromstring(apiresponse.content)

        if tree.reply.code == 0:
            return Response(tree)
        else:
            klass = from_code(tree.reply.code)
            desc = tree.reply.desc
            code = tree.reply.code
            data = getattr(tree.reply, 'data', '')
            raise klass(u"{0} ({1}) {2}".format(desc, code, data), code)
开发者ID:AntagonistHQ,项目名称:openprovider.py,代码行数:35,代码来源:api.py

示例3: renew_domain_request

 def renew_domain_request(self, domain, period):
     request = E.renewDomainRequest(
             _domain(domain),
             E.period(period),
     )
     response = self.request(request)
     return response.as_model(Model)
开发者ID:AntagonistHQ,项目名称:openprovider.py,代码行数:7,代码来源:domain.py

示例4: create_domain_request

    def create_domain_request(self, domain, period, owner_handle, admin_handle, tech_handle,
            billing_handle=None, reseller_handle=None, ns_group=None, ns_template_name=None,
            name_servers=None, use_domicile=False, promo_code=None, autorenew=None, comments=None,
            dnssec_keys=None, application_mode=None, is_private_whois_enabled=None,
            additional_data=None):

        request = E.createDomainRequest(
                _domain(domain),
                E.period(period),
                E.ownerHandle(owner_handle),
                E.adminHandle(admin_handle),
                E.techHandle(tech_handle),
                OE('billingHandle', billing_handle),
                OE('resellerHandle', reseller_handle),
                OE('nsGroup', ns_group),
                OE('nsTemplateName', ns_template_name),
                OE('nameServers', name_servers, transform=_nameservers),
                OE('useDomicile', use_domicile, transform=int),
                OE('promoCode', promo_code),
                OE('autorenew', autorenew),
                OE('comments', comments),
                OE('dnssecKeys', dnssec_keys, transform=_dnssec_keys),
                OE('applicationMode', application_mode),
                OE('isPrivateWhoisEnabled', is_private_whois_enabled, transform=int),
                _additional_data(additional_data),
        )
        response = self.request(request)
        return response.as_model(Model)
开发者ID:AntagonistHQ,项目名称:openprovider.py,代码行数:28,代码来源:domain.py

示例5: approve_transfer_domain_request

 def approve_transfer_domain_request(self, domain, approve, registrar_tag=None):
     request = E.approveTransferDomainRequest(
             _domain(domain),
             E.approve(int(approve)),
             OE('registrarTag', registrar_tag),
     )
     response = self.request(request)
     return response.as_model(Model)
开发者ID:AntagonistHQ,项目名称:openprovider.py,代码行数:8,代码来源:domain.py

示例6: retrieve_domain_request

 def retrieve_domain_request(self, domain, additional_data=False, registry_details=False):
     request = E.retrieveDomainRequest(
             _domain(domain),
             E.withAdditionalData(int(additional_data)),
             E.withRegistryDetails(int(registry_details)),
     )
     response = self.request(request)
     return response.as_model(DomainDetails)
开发者ID:AntagonistHQ,项目名称:openprovider.py,代码行数:8,代码来源:domain.py

示例7: retrieve_customer

    def retrieve_customer(self, handle, with_additional_data=False):
        """Retrieve information of an existing customer."""

        response = self.request(E.retrieveCustomerRequest(
            E.handle(handle),
            E.withAdditionalData(int(with_additional_data)),
        ))

        return response.as_model(Customer)
开发者ID:AntagonistHQ,项目名称:openprovider.py,代码行数:9,代码来源:customer.py

示例8: _get_phone_xml

def _get_phone_xml(parent, number):
    if not number:
        return ''

    country, area, subscriber = parse_phone_number(number)
    return E(parent,
            E.countryCode(country),
            E.areaCode(area),
            E.subscriberNumber(subscriber),
    )
开发者ID:AntagonistHQ,项目名称:openprovider.py,代码行数:10,代码来源:customer.py

示例9: modify_master_zone_dns_request

    def modify_master_zone_dns_request(self, domain, records=None):
        """Modify DNS Records"""

        self.request(
            E.modifyZoneDnsRequest(
                _domain(domain),
                E.type('master'),
                _records(records),
            ),
        )

        return True
开发者ID:aschenkels-ictstudio,项目名称:openprovider.py,代码行数:12,代码来源:nameserver.py

示例10: retrieve_extension

    def retrieve_extension(self, name, **kw):
        """Retrieve details on a single extension."""

        response = self.request(
            E.retrieveExtensionRequest(
                E.name(name),
                E.withDescription(int(kw.get("with_description", 0))),
                E.withPrice(int(kw.get("with_price", 0))),
                E.withUsageCount(int(kw.get("with_usage_count", 0))),
            )
        )

        return response.as_model(Extension)
开发者ID:aschenkels-ictstudio,项目名称:openprovider.py,代码行数:13,代码来源:extension.py

示例11: request_auth_code_domain_request

 def request_auth_code_domain_request(self, domain, auth_code_type=None):
     request = E.requestAuthCodeDomainRequest(
             _domain(domain),
             OE('authCodeType', auth_code_type),
     )
     response = self.request(request)
     return response.as_model(Model)
开发者ID:AntagonistHQ,项目名称:openprovider.py,代码行数:7,代码来源:domain.py

示例12: retrieve_price_domain_request

 def retrieve_price_domain_request(self, domain, operation=None):
     request = E.retrievePriceDomainRequest(
             _domain(domain),
             OE('operation', operation),
     )
     response = self.request(request)
     return response.as_model(Model)
开发者ID:AntagonistHQ,项目名称:openprovider.py,代码行数:7,代码来源:domain.py

示例13: retrieve_zone_dns_request

    def retrieve_zone_dns_request(self, name, with_records=True, with_history=False):

        request = E.retrieveZoneDnsRequest(
            OE('name', name),
            OE('withRecords', with_records),
            OE('withHistory', with_history),
        )
        response = self.request(request)
        return response.as_model(ZoneDetails)
开发者ID:aschenkels-ictstudio,项目名称:openprovider.py,代码行数:9,代码来源:nameserver.py

示例14: _additional_data

def _additional_data(data):
    if data is None:
        return None

    element = E.additionalData()
    for key, value in data.items():
        if key == 'birth_date':
            try:
                value = value.strftime('%Y-%m-%d')
            except AttributeError:
                pass
        element.append(E(snake_to_camel(key), value))
    return element
开发者ID:AntagonistHQ,项目名称:openprovider.py,代码行数:13,代码来源:customer.py

示例15: trade_domain_request

    def trade_domain_request(self, domain, period, owner_handle, admin_handle, tech_handle,
            billing_handle=None, reseller_handle=None, auth_code=None, ns_group=None,
            ns_template_name=None, name_servers=None, use_domicile=None, promo_code=None,
            dnssec_keys=None):

        request = E.tradeDomainRequest(
                _domain(domain),
                E.period(period),
                E.ownerHandle(owner_handle),
                E.adminHandle(admin_handle),
                E.techHandle(tech_handle),
                OE('billingHandle', billing_handle),
                OE('resellerHandle', reseller_handle),
                OE('authCode', auth_code),
                OE('nsGroup', ns_group),
                OE('nsTemplateName', ns_template_name),
                OE('nameServers', name_servers, transform=_nameservers),
                OE('useDomicile', use_domicile, transform=int),
                OE('promoCode', promo_code),
                OE('dnssecKeys', dnssec_keys, transform=_dnssec_keys),
        )
        response = self.request(request)
        return response.as_model(Model)
开发者ID:AntagonistHQ,项目名称:openprovider.py,代码行数:23,代码来源:domain.py


注:本文中的openprovider.modules.E类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。