[TimLinux] Python3 Coverity zeep/SOAP 库使用示例

Posted timlinux

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[TimLinux] Python3 Coverity zeep/SOAP 库使用示例相关的知识,希望对你有一定的参考价值。

废话不多说,上代码:

# 基于Coverity的示例
from zeep import Client
from zeep.wsse.username import UsernameToken

config_url = http://...:8080/ws/v9/configurationservice?wsdl
defect_url = http://...:8080/ws/v9/defectservice?wsdl

user_token = UsernameToken(loginuser, loginpasswd)

config_client = Client(config_url, wsse=user_token)
defect_client = Client(defect_url, wsse=user_token)

config_factory = config_client.type_factory(ns0)
defect_factory = defect_client.type_factory(ns0)

projectId = config_factory.projectIdDataObj(
    name=xxxx-project-name
)

filterSpec = defect_factory.snapshotScopeDefectFilterSpecDataObj()
pageSpec = defect_factory.pageSpecDataObj(pageSize=1, sortAscending=True, startIndex=0)
snapshotScope = defect_factory.snapshotScopeSpecDataObj(showSelector=firstAfter(2019-05-01 12:12:12))

d = {
    projectId: projectId,
    filterSpec: filterSpec,
    pageSpec: pageSpec,
    snapshotScope: snapshotScope
}

res = defect_client.service.getMergedDefectesForSnapshotScope(**d)

print(res.totalNumberOfRecords)

 

以上是关于[TimLinux] Python3 Coverity zeep/SOAP 库使用示例的主要内容,如果未能解决你的问题,请参考以下文章

[TimLinux] Python 元类

[TimLinux] Python 函数

[TimLinux] Python 装饰器

[TimLinux] myblog 创建第一个app

[TimLinux] Django 信号

[TimLinux] python-ldap 介绍