Exemplo n.º 1
0
 def get(self) -> Optional[Deck]:
     blob = league.random_legal_deck()
     if blob is None:
         APP.api.abort(404, 'No legal decks could be found')
         return None
     blob['url'] = url_for('deck', deck_id=blob['id'], _external=True)
     return blob
Exemplo n.º 2
0
def random_deck_api() -> Response:
    blob = league.random_legal_deck()
    if blob is None:
        return return_json({
            'error': True,
            'msg': 'No legal decks could be found'
        })
    blob['url'] = url_for('deck', deck_id=blob['id'], _external=True)
    return return_json(blob)