エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。
ここにツイート内容が記載されます https://b.hatena.ne.jp/URLはspanで囲んでください
Twitterで共有ONにすると、次回以降このダイアログを飛ばしてTwitterに遷移します
注目コメント算出アルゴリズムの一部にLINEヤフー株式会社の「建設的コメント順位付けモデルAPI」を使用しています
はじめての FastAPI(前編) https://qiita.com/uturned0/it ems/9c3d19c1f846a07ec779 の続き Handling ... はじめての FastAPI(前編) https://qiita.com/uturned0/it ems/9c3d19c1f846a07ec779 の続き Handling Errors¶ HTTPException http://0.0.0.0:8000/err/1 にいくと 404 が返る。raise するだけで json がレスポンスになるの最高。 from fastapi import FastAPI, Body, Query, HTTPException it ems = {"foo": "The Foo Wrestlers"} @app.get("/err/{it em_id}") async def read_it em(it em_id: str): if it em_id not in it ems: raise HTTPException(status_code=404, detail