예제 #1
0
 def get(self, start, stop):
     if max_user_requests(flask_jwt.current_identity.username):
         return max_requests_message(), 400
     max_stop = ItemModel.count_all_items()
     if (0 < stop <= max_stop) and (0 < start <= stop):
         return {
             'from':
             start,
             'to':
             stop,
             'items': [
                 item.json()
                 for item in ItemModel.get_range_items(start, stop)
             ]
         }
     else:
         return {'error': 'invalid range', 'from': start, 'to': stop}
예제 #2
0
    def get(self):
        if max_user_requests(flask_jwt.current_identity.username):
            return max_requests_message(), 400

        return {'total items': ItemModel.count_all_items()}