Compare commits
No commits in common. "23be0b74f94eefe1752ba2451d3fb58fcc9a6cb7" and "189518a2ba8bd3fedc26e4c7f02bf8b91de3d29f" have entirely different histories.
23be0b74f9
...
189518a2ba
@ -1,23 +0,0 @@
|
||||
meta {
|
||||
name: Add
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://localhost:11000/api/highlight/:module/:alder
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
params:path {
|
||||
module: catalog
|
||||
alder: add
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"item":1,
|
||||
"category":1
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
meta {
|
||||
name: Remove
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://localhost:11000/api/highlight/:module/:alder
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
params:path {
|
||||
module: catalog
|
||||
alder: remove
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"item":1,
|
||||
"category":1
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
meta {
|
||||
name: Add
|
||||
type: http
|
||||
seq: 1
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://localhost:11000/api/highlight/category/:alder
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
params:path {
|
||||
alder: add
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"title":"For your starter",
|
||||
"desc":null,
|
||||
"background":null,
|
||||
"illustration":null
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
meta {
|
||||
name: Detail
|
||||
type: http
|
||||
seq: 3
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://localhost:11000/api/highlight/category/:alder
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
params:path {
|
||||
alder: detail
|
||||
}
|
||||
|
||||
body:json {
|
||||
{"id":1}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
meta {
|
||||
name: Edit
|
||||
type: http
|
||||
seq: 4
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://localhost:11000/api/highlight/category/:alder
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
params:path {
|
||||
alder: edit
|
||||
}
|
||||
|
||||
body:json {
|
||||
{
|
||||
"id":1,
|
||||
"title":"For your starter (Edit)",
|
||||
"desc":null,
|
||||
"background":null,
|
||||
"illustration":null
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
meta {
|
||||
name: List
|
||||
type: http
|
||||
seq: 2
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://localhost:11000/api/highlight/category/:alder
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
params:path {
|
||||
alder: list
|
||||
}
|
||||
|
||||
body:json {
|
||||
{}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
meta {
|
||||
name: Remove
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://localhost:11000/api/highlight/category/:alder
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
params:path {
|
||||
alder: remove
|
||||
}
|
||||
|
||||
body:json {
|
||||
{"id":1}
|
||||
}
|
50
handler.py
50
handler.py
@ -5,17 +5,12 @@
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
# You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
|
||||
from bottle import Bottle, route, request, response
|
||||
from bottle import Bottle, route
|
||||
from config import directory
|
||||
|
||||
import templates.plain.main as template_public
|
||||
import modules.public.home as public_home
|
||||
|
||||
import modules.api.highlight.category as api_highlight_category
|
||||
import modules.api.highlight.catalog as api_highlight_catalog
|
||||
|
||||
import json
|
||||
|
||||
app = Bottle()
|
||||
|
||||
@app.route('/')
|
||||
@ -26,46 +21,3 @@ def index():
|
||||
}
|
||||
}
|
||||
return public_home.main().html(params)
|
||||
|
||||
@app.route('/api/highlight/category/<alder>', method=['OPTIONS', 'POST'])
|
||||
def index(alder):
|
||||
try:
|
||||
if request.method == 'OPTIONS':
|
||||
return None
|
||||
else:
|
||||
response.content_type = 'application/json'
|
||||
params = request.json
|
||||
if alder == 'add':
|
||||
return json.dumps(api_highlight_category.category().add(params), indent = 2).encode()
|
||||
elif alder == 'list':
|
||||
return json.dumps(api_highlight_category.category().list(params), indent = 2).encode()
|
||||
elif alder == 'detail':
|
||||
return json.dumps(api_highlight_category.category().detail(params), indent = 2).encode()
|
||||
elif alder == 'edit':
|
||||
return json.dumps(api_highlight_category.category().edit(params), indent = 2).encode()
|
||||
elif alder == 'remove':
|
||||
return json.dumps(api_highlight_category.category().remove(params), indent = 2).encode()
|
||||
else:
|
||||
return json.dumps({}, indent = 2).encode()
|
||||
except Exception as e:
|
||||
print(str(e),flush=True)
|
||||
return json.dumps({}, indent = 2).encode()
|
||||
|
||||
|
||||
@app.route('/api/highlight/catalog/<alder>', method=['OPTIONS', 'POST'])
|
||||
def index(alder):
|
||||
try:
|
||||
if request.method == 'OPTIONS':
|
||||
return None
|
||||
else:
|
||||
response.content_type = 'application/json'
|
||||
params = request.json
|
||||
if alder == 'add':
|
||||
return json.dumps(api_highlight_catalog.catalog().add(params), indent = 2).encode()
|
||||
elif alder == 'remove':
|
||||
return json.dumps(api_highlight_catalog.catalog().remove(params), indent = 2).encode()
|
||||
else:
|
||||
return json.dumps({}, indent = 2).encode()
|
||||
except Exception as e:
|
||||
print(str(e),flush=True)
|
||||
return json.dumps({}, indent = 2).encode()
|
||||
|
@ -69,8 +69,6 @@ class category:
|
||||
try:
|
||||
self.cursor.execute("SELECT * FROM `highlight_category` WHERE `id` = %s ; ", (id,) )
|
||||
d = self.cursor.fetchone()
|
||||
self.cursor.execute("SELECT * FROM `highlight_catalog` WHERE `category` = %s ; ", (id,) )
|
||||
d["catalog"] = self.cursor.fetchall()
|
||||
loggorilla.prcss(APIADDR, "Set Response")
|
||||
response["status" ] = "success"
|
||||
response["desc" ] = "data collected"
|
||||
|
@ -1,13 +0,0 @@
|
||||
import datetime
|
||||
|
||||
def prcss(loc, msg):
|
||||
print(f"[loggorilla][{datetime.datetime.now()}][\033[32mprcss\033[39m][\033[95m{loc}\033[39m] {msg}", flush=True)
|
||||
|
||||
def accss(loc, msg):
|
||||
print(f"[loggorilla][{datetime.datetime.now()}][\033[36maccss\033[39m][\033[95m{loc}\033[39m] {msg}", flush=True)
|
||||
|
||||
def fyinf(loc, msg):
|
||||
print(f"[loggorilla][{datetime.datetime.now()}][\033[93mfyinf\033[39m][\033[95m{loc}\033[39m] {msg}", flush=True)
|
||||
|
||||
def error(loc, msg):
|
||||
print(f"[loggorilla][{datetime.datetime.now()}][\033[31merror\033[39m][\033[95m{loc}\033[39m] {msg}", flush=True)
|
Loading…
Reference in New Issue
Block a user