Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 59 for HTTPException (0.07 sec)

  1. docs/pt/docs/tutorial/handling-errors.md

        "title": "towel",
        "size": "XL"
      }
    }
    ```
    
    #### O `HTTPException` do FastAPI vs o `HTTPException` do Starlette.
    
    O **FastAPI** tem o seu próprio `HTTPException`.
    
    E a classe de erro `HTTPException` do **FastAPI** herda da classe de erro do `HTTPException` do Starlette.
    
    A diferença entre os dois é a de que o `HTTPException` do **FastAPI** permite que você adicione *headers* que serão incluídos nas *responses*.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 10K bytes
    - Viewed (0)
  2. docs/em/docs/tutorial/handling-errors.md

        "size": "XL"
      }
    }
    ```
    
    #### FastAPI `HTTPException` 🆚 💃 `HTTPException`
    
    **FastAPI** ✔️ 🚮 👍 `HTTPException`.
    
    & **FastAPI**'Ⓜ `HTTPException` ❌ 🎓 😖 ⚪️➡️ 💃 `HTTPException` ❌ 🎓.
    
    🕴 🔺, 👈 **FastAPI**'Ⓜ `HTTPException` ✔ 👆 🚮 🎚 🔌 📨.
    
    👉 💪/⚙️ 🔘 ✳ 2️⃣.0️⃣ & 💂‍♂ 🚙.
    
    , 👆 💪 🚧 🙋‍♀ **FastAPI**'Ⓜ `HTTPException` 🛎 👆 📟.
    
    ✋️ 🕐❔ 👆 ® ⚠ 🐕‍🦺, 👆 🔜 ® ⚫️ 💃 `HTTPException`.
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 8.3K bytes
    - Viewed (0)
  3. docs/en/docs/tutorial/handling-errors.md

        "size": "XL"
      }
    }
    ```
    
    #### FastAPI's `HTTPException` vs Starlette's `HTTPException`
    
    **FastAPI** has its own `HTTPException`.
    
    And **FastAPI**'s `HTTPException` error class inherits from Starlette's `HTTPException` error class.
    
    The only difference is that **FastAPI**'s `HTTPException` accepts any JSON-able data for the `detail` field, while Starlette's `HTTPException` only accepts strings for it.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 9.1K bytes
    - Viewed (0)
  4. docs_src/app_testing/app_b_an_py310/main.py

    @app.get("/items/{item_id}", response_model=Item)
    async def read_main(item_id: str, x_token: Annotated[str, Header()]):
        if x_token != fake_secret_token:
            raise HTTPException(status_code=400, detail="Invalid X-Token header")
        if item_id not in fake_db:
            raise HTTPException(status_code=404, detail="Item not found")
        return fake_db[item_id]
    
    
    @app.post("/items/", response_model=Item)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Aug 15 22:31:16 UTC 2024
    - 1.1K bytes
    - Viewed (0)
  5. docs/ja/docs/tutorial/handling-errors.md

      }
    }
    ```
    
    #### FastAPIの`HTTPException`とStarletteの`HTTPException`
    
    **FastAPI**は独自の`HTTPException`を持っています。
    
    また、 **FastAPI**のエラークラス`HTTPException`はStarletteのエラークラス`HTTPException`を継承しています。
    
    唯一の違いは、**FastAPI** の`HTTPException`はレスポンスに含まれるヘッダを追加できることです。
    
    これはOAuth 2.0といくつかのセキュリティユーティリティのために内部的に必要とされ、使用されています。
    
    そのため、コード内では通常通り **FastAPI** の`HTTPException`を発生させ続けることができます。
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 11.8K bytes
    - Viewed (0)
  6. docs_src/sql_databases/tutorial002_an_py39.py

        hero = session.get(Hero, hero_id)
        if not hero:
            raise HTTPException(status_code=404, detail="Hero not found")
        return hero
    
    
    @app.patch("/heroes/{hero_id}", response_model=HeroPublic)
    def update_hero(hero_id: int, hero: HeroUpdate, session: SessionDep):
        hero_db = session.get(Hero, hero_id)
        if not hero_db:
            raise HTTPException(status_code=404, detail="Hero not found")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  7. docs_src/sql_databases/tutorial002_an.py

        hero = session.get(Hero, hero_id)
        if not hero:
            raise HTTPException(status_code=404, detail="Hero not found")
        return hero
    
    
    @app.patch("/heroes/{hero_id}", response_model=HeroPublic)
    def update_hero(hero_id: int, hero: HeroUpdate, session: SessionDep):
        hero_db = session.get(Hero, hero_id)
        if not hero_db:
            raise HTTPException(status_code=404, detail="Hero not found")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.6K bytes
    - Viewed (0)
  8. docs_src/sql_databases/tutorial002_py39.py

        if not hero:
            raise HTTPException(status_code=404, detail="Hero not found")
        return hero
    
    
    @app.patch("/heroes/{hero_id}", response_model=HeroPublic)
    def update_hero(
        hero_id: int, hero: HeroUpdate, session: Session = Depends(get_session)
    ):
        hero_db = session.get(Hero, hero_id)
        if not hero_db:
            raise HTTPException(status_code=404, detail="Hero not found")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.6K bytes
    - Viewed (0)
  9. docs/ru/docs/tutorial/dependencies/dependencies-with-yield.md

    ///
    
       **FastAPI** использует их "под капотом" с этой целью.
    
    ## Зависимости с `yield` и `HTTPException`
    
    Вы видели, что можно использовать зависимости с `yield` совместно с блоком `try`, отлавливающие исключения.
    
    Таким же образом вы можете поднять исключение `HTTPException` или что-то подобное в завершающем коде, после `yield`.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 19.5K bytes
    - Viewed (0)
  10. docs_src/sql_databases/tutorial001_an.py

        hero = session.get(Hero, hero_id)
        if not hero:
            raise HTTPException(status_code=404, detail="Hero not found")
        return hero
    
    
    @app.delete("/heroes/{hero_id}")
    def delete_hero(hero_id: int, session: SessionDep):
        hero = session.get(Hero, hero_id)
        if not hero:
            raise HTTPException(status_code=404, detail="Hero not found")
        session.delete(hero)
        session.commit()
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 1.8K bytes
    - Viewed (0)
Back to top