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()
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()
from run import app with app.app_context(): from queries.post_queries import update_keywords update_keywords()