python3調用webservice接口之多參數傳遞


from suds.client import Client

 

def func(url, operation, *args):
'''接口調用'''
  client = Client(url)
  result = eval("client.service.%s" % operation)(*args)  #eval將字符串轉換成變量使用

  return result

 

url = 'http://10.***.**.***:****/DaiDaiKan/DaiDaiKanService.asmx?wsdl'  #注意地址后面需要加wsdl

operation = 'Prereview'

name = '測試01'
reportId = '100'
reportSn = '2016072500003039963690'
mobile_token = '123'

func(url, operation, str(name), str(reportId), str(reportSn), str(mobile_token))

 

參考博客地址:

http://blog.csdn.net/qq_15013233/article/details/52369656

http://blog.csdn.net/xocom/article/details/64120902


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM