容联云短信测试

  • 容联云通讯是第三方平台,能够提供短信验证码和语音通信等功能,这里只测试使用短信验证码的功能,因此只需完成注册登录(无需实名认证等)即可使用其短信验证码免费测试服务。
  • python3 的代码示例
    • xmltojson.py文件
      import os
      import xml.etree.ElementTree as ET
      from xml.dom import minidom
      
      class xmltojson:
          #global var
          #show log
          SHOW_LOG = True
          #XML file
          XML_PATH = None
          a={
             }
          m=[]
          
          def get_root(self,path):
              '''parse the XML file,and get the tree of the XML file
              finally,return the root element of the tree.
              if the XML file dose not exist,then print the information'''
              #if os.path.exists(path):
                  #if SHOW_LOG:
                      #print('start to parse the file : [{}]'.format(path))
              tree = ET.fromstring(path)
              return tree
              #else:
                  #print('the path [{}] dose not exist!'.format(path))
          
          def get_element_tag(self,element):
              '''return the element tag if the element is not None.'''
              if element is not None:
                  
                  return element.tag
              else:
                  print('the element is None!')
          
          def get_element_attrib(self,element):
              '''return the element attrib if the element is not None.'''
              if element is not None:
                  
                  return element.attrib
              else:
                  print('the element is None!')
          
          def get_element_text(self,element):
              '''return the text of the element.'''
              if element is not None:
                  return element.text
              else:
                  print('the element is None!')
          
          def get_element_children(self,element):
              '''return the element children if the element is not None.'''
              if element is not None:
                  
                  return [c for c in element]
              else:
                  print('the element is None!')
          
          def get_elements_tag(self,elements):
              '''return the list of tags of element's tag'''
              if elements is not None:
                  tags = []
                  for e in elements:
                      tags.append(e.tag)
                  return tags
              else:
                  print('the elements is None!')
          
          def get_elements_attrib(self,elements):
              '''return the list of attribs of element's attrib'''
              if elements is not None:
                  attribs = []
                  for a in elements:
                      attribs.append(a.attrib)
                  return attribs
              else:
                  print('the elements is None!')
          
          def get_elements_text(self,elements):
              '''
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值