def apidocs():
url = urlparse(request.url)
if ":" in url.netloc:
host, port = url.netloc.split(":")
else:
host = url.netloc
port = "80"
base_path = url.path.replace('/apidocs','') if url.path != "/apidocs" else "/"
schemes = [url.scheme]
other_scheme = "https" if url.scheme is "http" else "http"
try:
if request.get(other_scheme+"://"+url.netloc+url.path.replace('/apidocs','')+"/scheme").status_code is 200:
schemes += [other_scheme]
except:
pass
r = make_response(swagger.json(schemes, host, port, base_path))
r.mimetype = 'application/json'
return r
# return send_from_directory("www","swagger.json")
评论列表
文章目录