Description
CREDENTIALS = {
'wsdl': 'https://uslugaterytws1test.stat.gov.pl/wsdl/terytws1.wsdl',
'username': 'MojLogin',
'password': 'MojeHaslo'
}
from zeep import Client
from zeep.wsse.username import UsernameToken
token = UsernameToken(
username=CREDENTIALS['username'],
password=CREDENTIALS['password']
)
client = Client(wsdl=CREDENTIALS['wsdl'], wsse=token)
print(client.service.CzyZalogowany())
Gdy uruchamiam powyższy kod, dostaję błąd:
Fault Traceback (most recent call last)
in
----> 1 print(client.service.CzyZalogowany())
/srv/conda/envs/notebook/lib/python3.7/site-packages/zeep/proxy.py in call(self, *args, **kwargs)
49 self._op_name,
50 args,
---> 51 kwargs,
52 )
53
/srv/conda/envs/notebook/lib/python3.7/site-packages/zeep/wsdl/bindings/soap.py in send(self, client, options, operation, args, kwargs)
133 return response
134
--> 135 return self.process_reply(client, operation_obj, response)
136
137 async def send_async(self, client, options, operation, args, kwargs):
/srv/conda/envs/notebook/lib/python3.7/site-packages/zeep/wsdl/bindings/soap.py in process_reply(self, client, operation, response)
227 fault_node = doc.find("soap-env:Body/soap-env:Fault", namespaces=self.nsmap)
228 if response.status_code != 200 or fault_node is not None:
--> 229 return self.process_error(doc, operation)
230
231 result = operation.process_reply(doc)
/srv/conda/envs/notebook/lib/python3.7/site-packages/zeep/wsdl/bindings/soap.py in process_error(self, doc, operation)
331 code=get_text("faultcode"),
332 actor=get_text("faultactor"),
--> 333 detail=fault_node.find("detail"),
334 )
335
Fault: An error occurred when processing the security tokens in the message.
Bardzo proszę o pomoc w rozwiązaniu tego problemu. Z góry dziękuję.