日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python webservice接口测试传参数_Python3 webservice接口测试方法是什么

發布時間:2023/12/9 python 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python webservice接口测试传参数_Python3 webservice接口测试方法是什么 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Python3 webservice接口測試方法是什么

發布時間:2020-06-23 14:07:46

來源:億速云

閱讀:92

作者:清晨

不懂Python3 webservice接口測試方法是什么?其實想解決這個問題也不難,下面讓小編帶著大家一起學習怎么去解決,希望大家閱讀完這篇文章后大所收獲。

一、使用python3做webervice接口測試的第三方庫選擇suds-jurko庫,可以直接pip命令直接下載,也可以在pypi官網下載壓縮包進行手動安裝

二、安裝好后,導入Client:from suds.client import Client。發送一條請求

from suds.client import Client

url = 'http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl'

client = Client(url)

# 打印所有webservice接口信息

print(client)

但是會出現錯誤:

Traceback (most recent call last):

File "E:/PycharmProjects/lianxiUItestSelenium/***.py", line 53, in

client = Client('http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl')

File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\client.py", line 115, in __init__

self.wsdl = reader.open(url)

File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\reader.py", line 150, in open

d = self.fn(url, self.options)

File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\wsdl.py", line 159, in __init__

self.build_schema()

File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\wsdl.py", line 220, in build_schema

self.schema = container.load(self.options)

File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\xsd\schema.py", line 94, in load

child.dereference()

File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\xsd\schema.py", line 319, in dereference

midx, deps = x.dependencies()

File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\xsd\sxbasic.py", line 437, in dependencies

e = self.__deref()

File "E:\PycharmProjects\lianxiUItestSelenium\venv\lib\site-packages\suds\xsd\sxbasic.py", line 483, in __deref

raise TypeNotFound(self.ref)

suds.TypeNotFound: Type not found: '(schema, http://www.w3.org/2001/XMLSchema, )'

三、只需要過濾掉一下地址就可以了。導入ImportDoctor和Import就可以

from suds.client import Client

from suds.xsd.doctor import ImportDoctor, Import

imp = Import('http://www.w3.org/2001/XMLSchema',location='http://www.w3.org/2001/XMLSchema.xsd')

imp.filter.add('http://WebXml.com.cn/')

doctor = ImportDoctor(imp)

client = Client('http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl',doctor=doctor)

print(client)

輸出結果:

(WeatherWebServiceSoap)

Methods (5):

getSupportCity(xs:string byProvinceName)

getSupportDataSet()

getSupportProvince()

getWeatherbyCityName(xs:string theCityName)

getWeatherbyCityNamePro(xs:string theCityName, xs:string theUserID)

感謝你能夠認真閱讀完這篇文章,希望小編分享Python3 webservice接口測試方法是什么內容對大家有幫助,同時也希望大家多多支持億速云,關注億速云行業資訊頻道,遇到問題就找億速云,詳細的解決方法等著你來學習!

總結

以上是生活随笔為你收集整理的python webservice接口测试传参数_Python3 webservice接口测试方法是什么的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。