示例#1
0
文件: keyword.py 项目: rafagonc/share
def explore_keyword_request_impl(args):
    try:
        update_keywords()
        keywords = query_availble_keywords()
        return Response(True, "Keywords Calculated", KeywordSchema(many=True).dumps(keywords).data).output()
    except Exception as exception:
        return Response(False, str(exception), None).output()
示例#2
0
文件: explore.py 项目: rafagonc/share
def explore_request_impl(args):
    try:
        update_keywords()
        user = user_from_token(args["token"])
        hottests_groups_result = json.loads(GroupSchema(many=True).dumps(hottest_groups(user)).data)
        lastest_groups_created_result = json.loads(GroupSchema(many=True).dumps(lastest_groups_created(user)).data)
        hottest_users_result = json.loads(UserSchema(many=True).dumps(hottest_users()).data)
        keywords_result = json.loads(KeywordSchema(many=True).dumps(query_availble_keywords()).data)
        result = dict(
            hottest_groups=hottests_groups_result,
            lastest_groups=lastest_groups_created_result,
            hottest_users=hottest_users_result,
            trending=keywords_result,
        )
        return Response(True, "Explore!", json.dumps(result)).output()
    except Exception as exception:
        return Response(False, str(exception), None).output()
示例#3
0
from run import app

with app.app_context():
    from queries.post_queries import update_keywords
    update_keywords()