UpnpPunch.py 文件源码

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

项目:zeronet-debian 作者: bashrc 项目源码 文件源码
def _send_soap_request(location, upnp_schema, control_url, soap_message):
    """
    Send out SOAP request to UPnP device and return a response.
    """
    headers = {
        'SOAPAction': (
            '"urn:schemas-upnp-org:service:{schema}:'
            '1#AddPortMapping"'.format(schema=upnp_schema)
        ),
        'Content-Type': 'text/xml'
    }
    conn = httplib.HTTPConnection(location.hostname, location.port)
    conn.request('POST', control_url, soap_message, headers)

    response = conn.getresponse()
    conn.close()

    return _parse_for_errors(response)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号