Bottle部署web服务及postman接口的方法
网络编程 2021-07-05 13:20www.168986.cn编程入门
这篇文章主要介绍了Bottle部署web服务及postman接口的方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下
Bottle是一个快速、简洁、轻量级的基于WSIG的微型Web框架,此框架只由一个 .py 文件,除了Python的标准库外,其不依赖任何其他模块。
from bottle import route, request, run import requests import cv2 import numpy as np @route('/testimg',method='POST')# def testimg(): try: #获取对应params值 result = {} result["name"] = request.query.name# result["nums"] = request.query.nums #获取json对应内容 #print(request.json) urllist = request.json["urllist"] #print(type(urllist)) #print(urllist) imgPath = [] for i in range(len(urllist)): imgPath.append(urllist[i]) for i in range(len(imgPath)): #print(imgPath[i]) #基于url获取数据 rev = requests.get(imgPath[i], verify=False) # , timeout=config.timeout img = cv2.imdecode(np.frombuffer(rev.content, np.uint8), cv2.IMREAD_COLOR) # 直接解码网络数据,获得bgr图片 rec = 0 return str(rec) except BaseException as e: logger.exception(e) return str(0) if __name__ == "__main__": run(host='172.17.0.2', port=49166, debug=False)
postman接口测试。
params传递参数。
body传递json等文本数据。
到此这篇关于Bottle部署web服务及postman接口的方法的文章就介绍到这了,更多相关Bottle部署web服务postman接口内容请搜索狼蚁SEO以前的文章或继续浏览狼蚁网站SEO优化的相关文章希望大家以后多多支持狼蚁SEO!
编程语言
- 机械手焊接机器人编程 机械手焊接设备编程
- vb数据库编程实例,vb做数据库
- tiobe世界编程语言排行榜,全球编程语言排行
- 成都java编程培训 成都it编程培训中心
- 编程基础培训,编程基础知识培训
- flash游戏编程基础教程,flash游戏开发教程
- 不会英语能学编程吗 不会英语可以学程序员吗
- 爱心代码编程C语言 爱心代码编程c语言公式
- c语言编程学习入门 c语言编程快速入门
- 西门子plc编程培训 西门子plc编程培训班
- 哪里可以学编程 台州哪里可以学编程
- 少儿编程哪个好 少儿编程哪个品牌好
- 编程是什么意思,图形编程是什么意思
- c语言编程软件下载,c语言编程软件在哪下载
- java编程软件下载,java编程下载手机版
- ug编程培训学校,ug编程培训教程