4
Я формирую запрос SOAPpy, но не могу понять, как установить атрибуты в теге. Вот мой код:Как установить атрибуты XML в SOAPpy с помощью python?
url = wsdlfile = 'https://stats2.overture.com/ExternalSOAP/statsPMCAPI_1_0.wsdl'
n = 'urn:yahoo:overture:stats:3.0'
server = WSDL.Proxy(wsdlfile)
server.soapproxy.config.dumpSOAPOut = 1
server.soapproxy.config.dumpSOAPIn = 1
result = server.getAvailablePmcReports(ReportAuth = {'username': username, 'cookie': YBY}, ReportRequest= '')
print(result)
, который выводит это:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:getAvailablePmcReports xmlns:ns1="urn:yahoo:overture:stats:3.0" SOAP-ENC:root="1">
<ReportRequest xsi:type="xsd:string"></ReportRequest>
<ReportAuth>
<username xsi:type="xsd:string">myuser</username>
<cookie xsi:type="xsd:string">cookie here...</cookie>
</ReportAuth>
</ns1:getAvailablePmcReports>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Но то, что я хочу это:
<ReportRequest startRow="0" shownRows="200">
Как добавить атрибуты? Спасибо.
Не могли бы вы, пожалуйста, предоставьте полный исходный документ XML и окончательный документ XML что вы хотите сформировать из него? Я могу помочь. –