我正在嘗試調(diào)用需要Null(None)屬性但將suds刪除的服務(wù)。我需要發(fā)送..<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對象,僅發(fā)送<ns1:Body> <ns0:QueryIntersection> <ns0:subjectRoad> <ns2:RoadName>BURKE</ns2:RoadName> <ns2:RoadType>ROAD</ns2:RoadType> </ns0:subjectRoad> </ns0:QueryIntersection>如果我在IntersectingRoad對象中設(shè)置值之一,它將發(fā)送它并正常工作,但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條經(jīng)驗 獲得超4個贊
Suds具有用于傳遞可選參數(shù)的特殊null()函數(shù),因為None被視為缺少值。
我認為您的情況將如下所示:
from suds import null
Int1 = client.factory.create('ns2:IntersectingRoad')
Int1.RoadName = null()
Int1.RoadType = null()
添加回答
舉報
0/150
提交
取消