Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for Rainbow (0.18 sec)

  1. docs/zh/docs/advanced/middleware.md

    app = SomeASGIApp()
    
    new_app = UnicornMiddleware(app, some_config="rainbow")
    ```
    
    但 FastAPI(实际上是 Starlette)提供了一种更简单的方式,能让内部中间件在处理服务器错误的同时,还能让自定义异常处理器正常运作。
    
    为此,要使用 `app.add_middleware()` (与 CORS 中的示例一样)。
    
    ```Python
    from fastapi import FastAPI
    from unicorn import UnicornMiddleware
    
    app = FastAPI()
    
    app.add_middleware(UnicornMiddleware, some_config="rainbow")
    ```
    
    `app.add_middleware()` 的第一个参数是中间件的类,其它参数则是要传递给中间件的参数。
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 22:44:27 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  2. docs/de/docs/advanced/middleware.md

    ```Python
    from unicorn import UnicornMiddleware
    
    app = SomeASGIApp()
    
    new_app = UnicornMiddleware(app, some_config="rainbow")
    ```
    
    Aber FastAPI (eigentlich Starlette) bietet eine einfachere Möglichkeit, welche sicherstellt, dass die internen Middlewares zur Behandlung von Serverfehlern und benutzerdefinierten Exceptionhandlern ordnungsgemäß funktionieren.
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 20:18:15 GMT 2024
    - 4.4K bytes
    - Viewed (0)
  3. docs/ru/docs/tutorial/handling-errors.md

    Но оно будет обработано `unicorn_exception_handler`.
    
    Таким образом, вы получите чистую ошибку с кодом состояния HTTP `418` и содержимым JSON:
    
    ```JSON
    {"message": "Oops! yolo did something. There goes a rainbow..."}
    ```
    
    !!! note "Технические детали"
        Также можно использовать `from starlette.requests import Request` и `from starlette.responses import JSONResponse`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 14.5K bytes
    - Viewed (0)
  4. docs/zh/docs/tutorial/handling-errors.md

    ```
    
    请求 `/unicorns/yolo` 时,路径操作会触发 `UnicornException`。
    
    但该异常将会被 `unicorn_exception_handler` 处理。
    
    接收到的错误信息清晰明了,HTTP 状态码为 `418`,JSON 内容如下:
    
    ```JSON
    {"message": "Oops! yolo did something. There goes a rainbow..."}
    
    ```
    
    !!! note "技术细节"
    
        `from starlette.requests import Request` 和 `from starlette.responses import JSONResponse` 也可以用于导入 `Request` 和 `JSONResponse`。
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  5. docs/en/docs/tutorial/handling-errors.md

    But it will be handled by the `unicorn_exception_handler`.
    
    So, you will receive a clean error, with an HTTP status code of `418` and a JSON content of:
    
    ```JSON
    {"message": "Oops! yolo did something. There goes a rainbow..."}
    ```
    
    !!! note "Technical Details"
        You could also use `from starlette.requests import Request` and `from starlette.responses import JSONResponse`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.1K bytes
    - Viewed (0)
  6. docs/pt/docs/tutorial/handling-errors.md

    Dessa forma você receberá um erro "limpo", com o HTTP status code `418` e um JSON com o conteúdo:
    
    ```JSON
    {"message": "Oops! yolo did something. There goes a rainbow..."}
    ```
    
    !!! note "Detalhes Técnicos"
        Você também pode usar `from starlette.requests import Request` and `from starlette.responses import JSONResponse`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 10K bytes
    - Viewed (0)
  7. docs/em/docs/tutorial/handling-errors.md

    ✋️ ⚫️ 🔜 🍵 `unicorn_exception_handler`.
    
    , 👆 🔜 📨 🧹 ❌, ⏮️ 🇺🇸🔍 👔 📟 `418` & 🎻 🎚:
    
    ```JSON
    {"message": "Oops! yolo did something. There goes a rainbow..."}
    ```
    
    !!! note "📡 ℹ"
        👆 💪 ⚙️ `from starlette.requests import Request` & `from starlette.responses import JSONResponse`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 8.3K bytes
    - Viewed (0)
  8. docs/de/docs/tutorial/handling-errors.md

    Aber diese wird von `unicorn_exception_handler` gehandhabt.
    
    Sie erhalten also einen sauberen Error mit einem Statuscode `418` und dem JSON-Inhalt:
    
    ```JSON
    {"message": "Oops! yolo did something. There goes a rainbow..."}
    ```
    
    !!! note "Technische Details"
        Sie können auch `from starlette.requests import Request` und `from starlette.responses import JSONResponse` verwenden.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 30 20:28:29 GMT 2024
    - 10.6K bytes
    - Viewed (0)
  9. docs/ja/docs/tutorial/handling-errors.md

    しかし、これは`unicorn_exception_handler`で処理されます。
    
    そのため、HTTPステータスコードが`418`で、JSONの内容が以下のような明確なエラーを受け取ることになります:
    
    ```JSON
    {"message": "Oops! yolo did something. There goes a rainbow..."}
    ```
    
    !!! note "技術詳細"
        また、`from starlette.requests import Request`と`from starlette.responses import JSONResponse`を使用することもできます。
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 11.8K bytes
    - Viewed (0)
  10. fastapi/applications.py

                return JSONResponse(
                    status_code=418,
                    content={"message": f"Oops! {exc.name} did something. There goes a rainbow..."},
                )
            ```
            """
    
            def decorator(func: DecoratedCallable) -> DecoratedCallable:
                self.add_exception_handler(exc_class_or_status_code, func)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 172.2K bytes
    - Viewed (0)
Back to top