25 lines
743 B
Python
25 lines
743 B
Python
|
from flask_restful import Resource
|
||
|
from flask import current_app as app
|
||
|
from flask import request
|
||
|
|
||
|
class Kingdom_Friend(Resource):
|
||
|
def get(self, id:int):
|
||
|
if "wiki" in request.args:
|
||
|
result = app.databases["Kingdom"].get_chara_wiki(id)
|
||
|
|
||
|
response = app.response_class(
|
||
|
response=result,
|
||
|
status=200,
|
||
|
mimetype='text/plain'
|
||
|
)
|
||
|
else:
|
||
|
result = app.databases["Kingdom"].get_chara(id)
|
||
|
|
||
|
response = app.response_class(
|
||
|
response=result,
|
||
|
status=200,
|
||
|
mimetype='application/json'
|
||
|
)
|
||
|
|
||
|
response.headers.add("Access-Control-Allow-Origin", "*")
|
||
|
return response
|