Beispiel #1
0
    @flask_transmute.annotate({"return": [Card]})
    def cards(self):
        """ retrieve all cards from the deck """
        return self._cards

    def reset(self):
        self._cards = []

app = Flask(__name__)
deck = Deck()

route_set = FlaskRouteSet()
route_set.route_object('/deck', deck,
                       # if exceptions are added to error_exceptions,
                       # they will be caught and raise a success: false
                       # response, with the error message being the message
                       # of the exception
                       error_exceptions=[DeckException])


def raise_401():
    raise ApiException("", status_code=401)

route_set.route_function("/raise_401", raise_401)


def raise_404():
    raise NotFoundException()

route_set.route_function("/raise_404", raise_404)
Beispiel #2
0
    @flask_transmute.annotate({"return": [Card]})
    def cards(self):
        """ retrieve all cards from the deck """
        return self._cards

    def reset(self):
        self._cards = []

app = Flask(__name__)
deck = Deck()

route_set = FlaskRouteSet()
route_set.route_object('/deck', deck,
                       # if exceptions are added to error_exceptions,
                       # they will be caught and raise a success: false
                       # response, with the error message being the message
                       # of the exception
                       error_exceptions=[DeckException])


def raise_401():
    raise ApiException("", status_code=401)

route_set.route_function("/raise_401", raise_401)


def raise_404():
    raise NotFoundException()

route_set.route_function("/raise_404", raise_404)