为了账号安全,请及时绑定邮箱和手机立即绑定

suds Send None属性

suds Send None属性

胡说叔叔 2021-03-08 17:13:12
我正在尝试调用需要Null(None)属性但将suds删除的服务。我需要发送..<ns1:Body>  <ns0:QueryIntersection>     <ns0:intersectingRoad>        <ns2:RoadName xsi:nil="true"/>        <ns2:RoadType xsi:nil="true"/>     </ns0:intersectingRoad>     <ns0:subjectRoad>        <ns2:RoadName>BURKE</ns2:RoadName>        <ns2:RoadType>ROAD</ns2:RoadType>     </ns0:subjectRoad>  </ns0:QueryIntersection>但suds删除了IntersectingRoad对象,仅发送<ns1:Body>  <ns0:QueryIntersection>     <ns0:subjectRoad>        <ns2:RoadName>BURKE</ns2:RoadName>        <ns2:RoadType>ROAD</ns2:RoadType>     </ns0:subjectRoad>  </ns0:QueryIntersection>如果我在IntersectingRoad对象中设置值之一,它将发送它并正常工作,但None也是有效的请求。这是我正在使用的代码的一部分...Int1 = client.factory.create('ns2:IntersectingRoad')Int1.RoadName = NoneInt1.RoadType = NoneInt2 = client.factory.create('ns2:SubjectRoad')Int2.RoadName = "BURKE"Int2.RoadType = "ROAD"try:    Ints = client.service.QueryIntersection(Int1,Int2, )except Exception as e:    print e.message请帮忙!
查看完整描述

1 回答

?
慕村9548890

TA贡献1884条经验 获得超4个赞

Suds具有用于传递可选参数的特殊null()函数,因为None被视为缺少值。


我认为您的情况将如下所示:


from suds import null


Int1 = client.factory.create('ns2:IntersectingRoad')

Int1.RoadName = null()

Int1.RoadType = null()


查看完整回答
反对 回复 2021-03-27
  • 1 回答
  • 0 关注
  • 133 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号