UpnpPunch.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:zeronet-debian 作者: bashrc 项目源码 文件源码
def _parse_igd_profile(profile_xml):
    """
    Traverse the profile xml DOM looking for either
    WANIPConnection or WANPPPConnection and return
    the value found as well as the 'controlURL'.
    """
    dom = parseString(profile_xml)

    service_types = dom.getElementsByTagName('serviceType')
    for service in service_types:
        if _node_val(service).find('WANIPConnection') > 0 or \
           _node_val(service).find('WANPPPConnection') > 0:
            control_url = service.parentNode.getElementsByTagName(
                'controlURL'
            )[0].childNodes[0].data
            upnp_schema = _node_val(service).split(':')[-2]
            return control_url, upnp_schema

    return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号