Bottle deployment method of web service and postman interface

Bottle deployment method of web service and postman interface:
Bottle is a fast, concise, and lightweight WSIG-based micro web framework. This framework consists of only one .py file and does not depend on any other modules except the Python standard library.
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) # ?
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 interface test.
Bottle deployment method of web service and postman interface:
0 Comments