美文网首页
Python调用webservice

Python调用webservice

作者: 积土成城 | 来源:发表于2020-02-03 10:38 被阅读0次

最近因工作需要,研究了一下调用webservice的方法,python 有两个包,支持调用webservice

  • 一个是suds
    示例代码:

    from suds.client import Client
    
    api_cli = Client("demourl")
    api_srv = api_cli.service
    tokenres = api_srv.demomethod(demoparams)
    print(tokenres)
    print(tokenres.result)
    

有个小问题: 参数名 不知道 以_开头, 如 _token

  • 另一个是zeep
    示例代码:

    from zeep import Client
    
    api_cli = Client("demourl")
    api_srv = api_cli.service
    tokenres = api_cli.service.demomethod(**demoparams)
    print(tokenres)
    print(tokenres.result)
    

希望对您有所帮助,谢谢

相关文章

网友评论

      本文标题:Python调用webservice

      本文链接:https://www.haomeiwen.com/subject/fgthxhtx.html