Files
mdserver-web/class/core/ssl_api.py
T
2019-02-11 19:22:53 +08:00

42 lines
960 B
Python
Executable File

# coding: utf-8
import psutil
import time
import os
import sys
import public
import re
import json
import pwd
from flask import session
from flask import request
class ssl_api:
def __init__(self):
pass
##### ----- start ----- ###
# 获取证书列表
def getCertListApi(self):
try:
vpath = public.getServerDir() + '/ssl'
if not os.path.exists(vpath):
os.system('mkdir -p ' + vpath)
data = []
for d in os.listdir(vpath):
mpath = vpath + '/' + d + '/info.json'
if not os.path.exists(mpath):
continue
tmp = public.readFile(mpath)
if not tmp:
continue
tmp1 = json.loads(tmp)
data.append(tmp1)
return data
except:
return []
##### ----- end ----- ###