eoLinker-API_Shop_常见疾病查询_API接口_Python调用示例代码
eoLinker-API Shop 常常见见疾病疾病查询查询 Python调调用示例代用示例代码码常常见见疾病疾病查询查询提供所患疾病的病因、症状、检查、用药、治疗、并发症等方面的详细分析资料该产该产品品拥拥有以下有以下APIs: :1.获取疾病部位列表2.通过部位获取疾病列表3.关键字获取疾病列表4.获取疾病列表5.查询疾病信息6.通过症状获取疾病列表注意,注意,该该示例代示例代码仅码仅适用于适用于 www.apishop.net 网站下网站下API 使用使用该产该产品前,您需要通品前,您需要通过过 https:/www.apishop.net/#/api/detail/?productID=215 申申请请API服服务务1.获获取疾病部位列表取疾病部位列表 #!/usr/bin/env python # -*- coding: utf-8 -*- # 测试环境: python2.7 # 安装requests依赖 => pip install requests/ easy_install requests# 导入requests依赖 import requests import json import sysreload(sys) sys.setdefaultencoding('utf-8')def apishop_send_request(method, url, params=None, headers=None):'''转发请求到目的主机param method str 请求方法param url str 请求地址param params dict 请求参数param headers dict 请求头'''method = str.upper(method)if method = 'POST':return requests.post(url=url, data=params, headers=headers)elif method = 'GET':return requests.get(url=url, params=params, headers=headers)else:return Nonemethod = “POST“ url = “https:/api.apishop.net/common/disease/queryDiseaseSiteList“ headers = None params = “apiKey“:“your_api_key“, #需要从www.apishop.net获取 result = apishop_send_request(method=method, url=url, params=params, headers=headers) if result:body = result.textresponse = json.loads(body)status_code = response“statusCode“if (status_code = '000000'):# 状态码为000000, 说明请求成功print('请求成功:%s' % (body,)else:# 状态码非000000, 说明请求失败print('请求失败: %s' % (body,) else:# 返回内容异常,发送请求失败print('发送请求失败')2.通通过过部位部位获获取疾病列表取疾病列表 #!/usr/bin/env python # -*- coding: utf-8 -*- # 测试环境: python2.7 # 安装requests依赖 => pip install requests/ easy_install requests# 导入requests依赖 import requests import json import sysreload(sys) sys.setdefaultencoding('utf-8')def apishop_send_request(method, url, params=None, headers=None):'''转发请求到目的主机param method str 请求方法param url str 请求地址param params dict 请求参数param headers dict 请求头'''method = str.upper(method)if method = 'POST':return requests.post(url=url, data=params, headers=headers)elif method = 'GET':return requests.get(url=url, params=params, headers=headers)else:return Nonemethod = “POST“ url = “https:/api.apishop.net/common/disease/queryDiseaseListBySite“ headers = None params = “apiKey“:“your_api_key“, #需要从www.apishop.net获取 “page“:“ #当前页码(默认1) “pageSize“:“ #该页疾病数量(默认15) “site“:“ #发病部位 result = apishop_send_request(method=method, url=url, params=params, headers=headers) if result:body = result.textresponse = json.loads(body)status_code = response“statusCode“if (status_code = '000000'):# 状态码为000000, 说明请求成功print('请求成功:%s' % (body,)else:# 状态码非000000, 说明请求失败print('请求失败: %s' % (body,) else:# 返回内容异常,发送请求失败print('发送请求失败')3.关关键键字字获获取疾病列表取疾病列表 #!/usr/bin/env python # -*- coding: utf-8 -*- # 测试环境: python2.7 # 安装requests依赖 => pip install requests/ easy_install requests# 导入requests依赖 import requests import json import sysreload(sys) sys.setdefaultencoding('utf-8')def apishop_send_request(method, url, params=None, headers=None):'''转发请求到目的主机param method str 请求方法param url str 请求地址param params dict 请求参数param headers dict 请求头'''method = str.upper(method)if method = 'POST':return requests.post(url=url, data=params, headers=headers)elif method = 'GET':return requests.get(url=url, params=params, headers=headers)else:return Nonemethod = “POST“ url = “https:/api.apishop.net/common/disease/queryDiseaseListByKeyword“ headers = None params = “apiKey“:“your_api_key“, #需要从www.apishop.net获取 “page“:“ #当前页码(默认1) “pageSize“:“ #该页疾病数量(默认15) “keyword“:“ #关键字 result = apishop_send_request(method=method, url=url, params=params, headers=headers) if result:body = result.textresponse = json.loads(body)status_code = response“statusCode“if (status_code = '000000'):# 状态码为000000, 说明请求成功print('请求成功:%s' % (body,)else:# 状态码非000000, 说明请求失败print('请求失败: %s' % (body,) else:# 返回内容异常,发送请求失败print('发送请求失败')4.获获取疾病列表取疾病列表 #!/usr/bin/env python # -*- coding: utf-8 -*- # 测试环境: python2.7 # 安装requests依赖 => pip install requests/ easy_install requests# 导入requests依赖 import requests import json import sysreload(sys) sys.setdefaultencoding('utf-8')def apishop_send_request(method, url, params=None, headers=None):'''转发请求到目的主机param method str 请求方法param url str 请求地址param params dict 请求参数param headers dict 请求头'''method = str.upper(method)if method = 'POST':return requests.post(url=url, data=params, headers=headers)elif method = 'GET':return requests.get(url=url, params=params, headers=headers)else:return Nonemethod = “POST“url = “https:/api.apishop.net/common/disease/queryDiseaseList“ headers = None params = “apiKey“:“your_api_key“, #需要从www.apishop.net获取 “page“:“ #当前页码(默认1) “pageSize“:“ #该页疾病数量(默认15) result = apishop_send_request(method=method, url=url, params=params, headers=headers) if result:body = result.textresponse = json.loads(body)status_code = response“statusCode“if (status_code = '000000'):# 状态码为000000, 说明请求成功print('请求成功:%s' % (body,)else:# 状态码非000000, 说明请求失败print('请求失