|
|
|
@ -45,10 +45,19 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
|
|
self.end_headers()
|
|
|
|
|
if self.path =="/":
|
|
|
|
|
#print("data:\t" + self.get_data())
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
with open('./views/index.html', 'tr') as f:
|
|
|
|
|
self.r_t=f.read()
|
|
|
|
|
print(self.client_address)
|
|
|
|
|
"""
|
|
|
|
|
try:
|
|
|
|
|
with open('./pkgs.json', 'tr') as fn:
|
|
|
|
|
data = fn.read()
|
|
|
|
|
pkg_list = json.loads(data)
|
|
|
|
|
print(pkg_list)
|
|
|
|
|
except Exception (e):
|
|
|
|
|
print(str(e))
|
|
|
|
|
self.r_t = json.dumps({"dump_portage": pkg_list})
|
|
|
|
|
|
|
|
|
|
elif self.path == '/main':
|
|
|
|
|
#print(self.rfile.read())
|
|
|
|
@ -80,8 +89,7 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
|
|
try:
|
|
|
|
|
with open('./pkgs.json', 'tr') as fn:
|
|
|
|
|
data = fn.read()
|
|
|
|
|
pkg_list = json.load
|
|
|
|
|
s(data)
|
|
|
|
|
pkg_list = json.loads(data)
|
|
|
|
|
print(pkg_list)
|
|
|
|
|
except Exception (e):
|
|
|
|
|
print(str(e))
|
|
|
|
@ -102,20 +110,20 @@ class Handler(BaseHTTPRequestHandler):
|
|
|
|
|
print(config)
|
|
|
|
|
print(param)
|
|
|
|
|
|
|
|
|
|
elif self.path == 'find':
|
|
|
|
|
elif self.path == '/find':
|
|
|
|
|
param = request['params']['name']
|
|
|
|
|
pk_list = []
|
|
|
|
|
search_result = {}
|
|
|
|
|
#if len(param.split('/')) == 2:
|
|
|
|
|
# param = param.split('/')[1]
|
|
|
|
|
#p_list = on_find(param)
|
|
|
|
|
#print(p_list)
|
|
|
|
|
#if len(p_list) == 0:
|
|
|
|
|
# print("Never Found")
|
|
|
|
|
# self.r_t = str(json.dumps({"Package_result": p_list}))
|
|
|
|
|
#else:
|
|
|
|
|
#for p in p_list:
|
|
|
|
|
#print(p)
|
|
|
|
|
if len(param.split('/')) == 2:
|
|
|
|
|
param = param.split('/')[1]
|
|
|
|
|
p_list = on_find(param)
|
|
|
|
|
print(p_list)
|
|
|
|
|
if len(p_list) == 0:
|
|
|
|
|
print("Never Found")
|
|
|
|
|
self.r_t = str(json.dumps({"Package_result": p_list}))
|
|
|
|
|
else:
|
|
|
|
|
for p in p_list:
|
|
|
|
|
print(p)
|
|
|
|
|
if len(param.split("/")) == 2:
|
|
|
|
|
pk_list.append(search(param.split("/")[1]))
|
|
|
|
|
else:
|
|
|
|
|