コード例 #1
0
def process_multiple_readings():
    # api_response = ApiResponse()
    flapp.logger.info('Received %s bytes of compressed data' %
                      sys.getsizeof(request.data))
    decompressed = zlib.decompress(request.data)
    response = ApiResponse(request)
    try:
        request_json = json.loads(decompressed)
    except Exception, e:
        print e
コード例 #2
0
ファイル: comment.py プロジェクト: RuiCoreSci/flask-restful
    def post(self, topic_id, post_id) -> ApiResponse:
        kwargs = self.parsed_args
        comment = CommentHandler(topic_id=topic_id,
                                 post_id=post_id).create_comment(**kwargs)

        return ApiResponse().ok(comment)
コード例 #3
0
ファイル: user.py プロジェクト: RuiCoreSci/flask-restful
 def put(self, user_id) -> ApiResponse:
     kwargs = self.parsed_args
     user = UserHandler(user_id).update(**kwargs)
     return ApiResponse().ok(user)
コード例 #4
0
 def put(self, topic_id) -> ApiResponse:
     kwargs = self.parsed_args
     topic = TopicHandler(topic_id).update_topic(**kwargs)
     return ApiResponse().ok(topic)
コード例 #5
0
 def get_api_response(response):
     json_dict = json.loads(response.text)
     api_response = ApiResponse(**json_dict)
     return api_response
コード例 #6
0
ファイル: user.py プロジェクト: RuiCoreSci/flask-restful
 def post(self) -> ApiResponse:
     # 新增一个用户
     kwargs = self.parsed_args
     user = UserHandler.create(**kwargs)
     return ApiResponse().ok(user)
コード例 #7
0
 def delete(self, root_topic_id) -> ApiResponse:
     return ApiResponse().ok(RootTopicHandler(root_topic_id).delete_topic())
コード例 #8
0
    def get(self, topic_id) -> ApiResponse:
        kwargs = self.parsed_args
        posts = PostHandler(topic_id).get_posts(**kwargs)

        return ApiResponse().ok(posts)
コード例 #9
0
 def get(self, root_topic_id) -> ApiResponse:
     return ApiResponse().ok(RootTopicHandler(root_topic_id).get_topic())
コード例 #10
0
 def put(self, root_topic_id) -> ApiResponse:
     kwargs = self.parsed_args
     return ApiResponse().ok(RootTopicHandler(root_topic_id).update_topic(**kwargs))
コード例 #11
0
    def post(self) -> ApiResponse:
        kwargs = self.parsed_args
        topic = TopicHandler().create_topic(**kwargs)

        return ApiResponse().ok(topic)
コード例 #12
0
 def get(self) -> ApiResponse:
     topics = TopicHandler().get_topics()
     return ApiResponse().ok(topics)
コード例 #13
0
 def delete(self, topic_id) -> ApiResponse:
     TopicHandler(topic_id).delete_topic()
     return ApiResponse().ok()
コード例 #14
0
 def get(self, topic_id, post_id) -> ApiResponse:
     post = PostHandler(topic_id=topic_id, post_id=post_id).get_post()
     return ApiResponse().ok(post)
コード例 #15
0
 def get(self):
     return ApiResponse().ok(RootTopicHandler().get_topics())
コード例 #16
0
    def delete(self, topic_id, post_id) -> ApiResponse:
        PostHandler(topic_id, post_id).delete_post()

        return ApiResponse().ok()
コード例 #17
0
 def post(self):
     kwargs = self.parsed_args
     return ApiResponse().ok(RootTopicHandler().create_topic(**kwargs))
コード例 #18
0
 def post(self, topic_id) -> ApiResponse:
     kwargs = self.parsed_args
     post = PostHandler(topic_id).create_post(**kwargs)
     return ApiResponse().ok(post)
コード例 #19
0
ファイル: comment.py プロジェクト: RuiCoreSci/flask-restful
 def get(self, topic_id, post_id, comment_id) -> ApiResponse:
     comment = CommentHandler(topic_id, post_id, comment_id).get_comment()
     return ApiResponse().ok(comment)
コード例 #20
0
ファイル: user.py プロジェクト: RuiCoreSci/flask-restful
 def get(self) -> ApiResponse:
     # 获取所有的用户
     users = UserHandler.get_users()
     return ApiResponse().ok(users)
コード例 #21
0
ファイル: comment.py プロジェクト: RuiCoreSci/flask-restful
 def delete(self, topic_id, post_id, comment_id) -> ApiResponse:
     CommentHandler(topic_id, post_id, comment_id).delete_comment()
     return ApiResponse().ok()
コード例 #22
0
ファイル: user.py プロジェクト: RuiCoreSci/flask-restful
 def get(self, user_id) -> ApiResponse:
     user = UserHandler(user_id).get_user()
     return ApiResponse().ok(user)
コード例 #23
0
ファイル: comment.py プロジェクト: RuiCoreSci/flask-restful
    def get(self, topic_id, post_id) -> ApiResponse:
        kwargs = self.parsed_args
        comments = CommentHandler(topic_id=topic_id,
                                  post_id=post_id).get_comments(**kwargs)

        return ApiResponse().ok(comments)
コード例 #24
0
ファイル: user.py プロジェクト: RuiCoreSci/flask-restful
 def delete(self, user_id) -> ApiResponse:
     UserHandler(user_id).delete()
     return ApiResponse().ok()
コード例 #25
0
 def get(self, topic_id) -> ApiResponse:
     topic = TopicHandler(topic_id).get_topic()
     return ApiResponse().ok(topic)