python 调用webservices 接口
# python 调用webservice 接口 from suds.client import Client import json ''' 1.http 时后调用 需要忽略ssl 证书认证 ssl._create_default_https_context = ssl.create_unverified_context ''' url = 'xxxxx' client = Client(url) data = {} # queryTimeout webservices 服务提供方法 res = client.service.queryTimeout(json.dumps(data))
now_time = int(time.strftime('%Y%m%d%H%M%S', time.localtime(time.time())))
python 测试接口
import json import requests requests.packages.urllib3.disable_warnings() def get_test(url): v = requests.get(url, verify=False).text print json.loads(v)['msg'].encode('utf8').decode('utf8') def post_test(url,task_id): data = {cccccccccccccccccccccc} res = requests.post(url, data, verify=False) ####取消https 验证 print res.text print json.loads(res.text)['msg'] #信息 print json.loads(res.text)['status'] #状态码 # url = '' get_test(url) # url='' post_test(url,'125h8')
本文来自博客园,作者:南鱼羁荒渡,转载请注明原文链接:https://www.cnblogs.com/nanyu/p/11453904.html