def make_deck() -> Response:
    try:
        n_decks = request.get_json()["decks"]
        dealer.logger.info(f"make_deck {request.args}")
    except Exception as ex:
        abort(HTTPStatus.BAD_REQUEST)

    decks = get_decks()
    id = str(uuid.uuid1())
    decks[id] = Deck(n=n_decks)

    response_json = jsonify(status="ok", id=id)
    response = make_response(response_json, HTTPStatus.CREATED)
    response.headers["Location"] = url_for("get_one_deck_count", id=str(id))
    response.headers["Content-Type"] = "application/json;charset=utf-8"
    return response
def make_deck() -> Response:
    try:
        # More Typical to use request.get_json() in POST
        dealer.logger.info(f"make_deck {request.args}")
        n_decks = int(request.args.get("decks", 1))
        assert 1 <= n_decks
    except Exception as ex:
        abort(HTTPStatus.BAD_REQUEST)

    decks = get_decks()
    id = str(uuid.uuid1())
    decks[id] = Deck(n=n_decks)

    response_json = jsonify(status="ok", id=id)
    response = make_response(response_json, HTTPStatus.CREATED)
    response.headers["Location"] = url_for("get_deck", id=str(id))
    return response
def get_deck() -> Deck:
    global deck
    if deck is None:
        random.seed(os.environ.get("DEAL_APP_SEED"))
        deck = Deck()
    return deck