Python Zeep:400客户端错误:url请求错误

Python Zeep:400客户端错误:url请求错误,python,soap,zeep,Python,Soap,Zeep,我正在使用zeep库进行post请求。下面是我的代码 来自zeep导入客户端的 导入logging.config logging.config.dictConfig({ “版本”:1, “格式化程序”:{ “冗长的”:{ “格式”:“%(名称)s:%(消息)s” } }, “处理程序”:{ “控制台”:{ “级别”:“调试”, 'class':'logging.StreamHandler', “格式化程序”:“详细”, }, }, “伐木工人”:{ “zeep.transports”:{ “级别

我正在使用zeep库进行post请求。下面是我的代码

来自zeep导入客户端的

导入logging.config
logging.config.dictConfig({
“版本”:1,
“格式化程序”:{
“冗长的”:{
“格式”:“%(名称)s:%(消息)s”
}
},
“处理程序”:{
“控制台”:{
“级别”:“调试”,
'class':'logging.StreamHandler',
“格式化程序”:“详细”,
},
},
“伐木工人”:{
“zeep.transports”:{
“级别”:“调试”,
"传播":对,,
“处理程序”:[“控制台”],
},
}
})
wsdl=”https://api2.brinkpos.net/Settings.svc?WSDL"
客户端=客户端(wsdl)
结果=client.service.getModifierGroup(accessToken、locationToken)
打印(结果)
我在第
client=client(wsdl)
行得到一个错误。请在下面找到完整的日志:

/Users/dilipyadav/githome/elrond/venv/bin/python /Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 65300 --file /Users/dilipyadav/githome/gimli/test/brink_test.py
pydev debugger: process 18141 is connecting

Connected to pydev debugger (build 192.5728.105)
zeep.transports: Loading remote data from: https://api2.brinkpos.net/Settings.svc?WSDL
Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 2060, in <module>
    main()
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 2054, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1405, in run
    return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1412, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/dilipyadav/githome/gimli/test/brink_test.py", line 28, in <module>
    client = Client(wsdl)
  File "/Users/dilipyadav/githome/elrond/venv/lib/python3.7/site-packages/zeep/client.py", line 68, in __init__
    self.wsdl = Document(wsdl, self.transport, settings=self.settings)
  File "/Users/dilipyadav/githome/elrond/venv/lib/python3.7/site-packages/zeep/wsdl/wsdl.py", line 80, in __init__
    document = self._get_xml_document(location)
  File "/Users/dilipyadav/githome/elrond/venv/lib/python3.7/site-packages/zeep/wsdl/wsdl.py", line 143, in _get_xml_document
    location, self.transport, self.location, settings=self.settings
  File "/Users/dilipyadav/githome/elrond/venv/lib/python3.7/site-packages/zeep/loader.py", line 78, in load_external
    content = transport.load(url)
  File "/Users/dilipyadav/githome/elrond/venv/lib/python3.7/site-packages/zeep/transports.py", line 110, in load
    content = self._load_remote_data(url)
  File "/Users/dilipyadav/githome/elrond/venv/lib/python3.7/site-packages/zeep/transports.py", line 127, in _load_remote_data
    response.raise_for_status()
  File "/Users/dilipyadav/githome/elrond/venv/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api2.brinkpos.net/Settings.svc?WSDL

Process finished with exit code 1
/Users/dilipyadav/githome/elrond/venv/bin/python/Applications/PyCharm.app/Contents/helpers/pydev/pydev.py--multiproc--qt support=auto--client 127.0.0.1--port 65300--file/Users/dilipyadav/githome/gimli/test/brink_test.py
pydev调试器:进程18141正在连接
已连接到pydev调试器(内部版本192.5728.105)
zeep.transports:从以下位置加载远程数据:https://api2.brinkpos.net/Settings.svc?WSDL
回溯(最近一次呼叫最后一次):
文件“/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py”,第2060行,在
main()
文件“/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py”,第2054行,主目录
globals=debugger.run(setup['file'],None,None,is_模块)
文件“/Applications/PyCharm.app/Contents/helpers/pydev/pydev.py”,第1405行,运行中
返回self.\u exec(是模块、入口点、模块名称、文件、全局、局部)
文件“/Applications/PyCharm.app/Contents/helpers/pydev/pydev.py”,第1412行,in_exec
pydev_imports.execfile(文件、全局、局部)#执行脚本
文件“/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py”,execfile中第18行
exec(编译(内容+“\n”,文件,'exec'),全局,loc)
文件“/Users/dilipyadav/githome/gimli/test/brink_test.py”,第28行,在
客户端=客户端(wsdl)
文件“/Users/dilipyadav/githome/elrond/venv/lib/python3.7/site packages/zeep/client.py”,第68行,在__
self.wsdl=Document(wsdl,self.transport,settings=self.settings)
文件“/Users/dilipyadav/githome/elrond/venv/lib/python3.7/site packages/zeep/wsdl/wsdl.py”,第80行,在__
document=self.\u获取\u xml\u文档(位置)
文件“/Users/dilipyadav/githome/elrond/venv/lib/python3.7/site packages/zeep/wsdl/wsdl.py”,第143行,在xml文档中
位置,self.transport,self.location,settings=self.settings
文件“/Users/dilipyadav/githome/elrond/venv/lib/python3.7/site packages/zeep/loader.py”,第78行,在load\u external中
content=transport.load(url)
文件“/Users/dilipyadav/githome/elrond/venv/lib/python3.7/site packages/zeep/transports.py”,第110行,已加载
内容=自身。\加载\远程\数据(url)
文件“/Users/dilipyadav/githome/elrond/venv/lib/python3.7/site packages/zeep/transports.py”,第127行,加载远程数据
响应。针对_状态()提出_
文件“/Users/dilipyadav/githome/elrond/venv/lib/python3.7/site packages/requests/models.py”,第940行,处于raise_for_状态
引发HTTPError(http\u error\u msg,response=self)
requests.exceptions.HTTPError:400客户端错误:url请求错误:https://api2.brinkpos.net/Settings.svc?WSDL
进程已完成,退出代码为1
我在创建客户机对象本身时失败,因此也无法记录post请求

如果您需要更多信息,请告诉我。

我必须重写dev wsdl()以连接到prod()。因此,我必须通过创建新的ServiceProxy对象

它提到了如何处理WSDL位于端点的不同地址的情况

下面的工作片段:

client = Client(wsdl=wsdl)
service = client.create_service(
    '{http://tempuri.org/}BasicHttpBinding_ISettingsWebService',
    'https://api2.brinkpos.net/Settings.svc?wsdl')
result = service.GetModifierGroups(accesstoken, locationtoken)
print(result)
我必须重写dev wsdl()以连接到prod()。因此,我必须通过创建新的ServiceProxy对象

它提到了如何处理WSDL位于端点的不同地址的情况

下面的工作片段:

client = Client(wsdl=wsdl)
service = client.create_service(
    '{http://tempuri.org/}BasicHttpBinding_ISettingsWebService',
    'https://api2.brinkpos.net/Settings.svc?wsdl')
result = service.GetModifierGroups(accesstoken, locationtoken)
print(result)