1
私はsudsによって作成されたXMLオブジェクトに署名しようとしていましたが、私は運がありません。PythonでXMLに署名する方法(suds)
現在のスクリプトは次のようになります。
from suds.client import Client
from suds.transport.http import HttpAuthenticated
from suds.transport import Reply, TransportError
import requests
class RequestsTransport(HttpAuthenticated):
def __init__(self, **kwargs):
self.cert = kwargs.pop('cert', None)
HttpAuthenticated.__init__(self, **kwargs)
def send(self, request):
self.addcredentials(request)
resp = requests.post(
request.url,
data=request.message,
headers=request.headers,
cert=self.cert,
verify=True
)
result = Reply(resp.status_code, resp.headers, resp.content)
return result
url = 'URL'
headers = {"Content-Type": "text/xml;charset=UTF-8",
"SOAPAction": ""}
t = RequestsTransport(cert=("path to cert","path to key"))
client = Client(url, headers=headers, transport=t)
私はメソッドを作成し、署名する必要があります。私はチェックしているWSDLの公開証明書のためのpemファイルを持っています。また
、私は私が取得要求に署名いけない場合:私はそれのpython-WSSE(https://py-wsse.readthedocs.io/en/latest/)作品を見つけ