python实现onvif协议-2

发布时间:2019-09-23 17:07:32编辑:auto阅读(2799)

    from suds.client import Client
    from suds.wsse import Security
    from suds_passworddigest.token import UsernameDigestToken

    url = 'file:///home/aphero/python/wsdl/media.wsdl'
    xadd='http://1.1.1.1/onvif/Media'
    client=Client(url,location=xadd)
    security = Security()
    token = UsernameDigestToken("admin", "12345")
    security.tokens.append(token)
    client.set_options(wsse=security)


    profiles=client.service.GetProfiles()
    for profile in profiles:
        print profile._token,profile.Name
        param={"StreamSetup":profile.Name,"ProfileToken":profile._token}
        MediaUri=client.service.GetStreamUri(param)
        print MediaUri.Uri

关键字