- Sort Score
- Num 10 results
- Language All
Results 1 - 10 of 18 for rainbow (0.49 seconds)
-
docs/en/docs/advanced/middleware.md
```Python from unicorn import UnicornMiddleware app = SomeASGIApp() new_app = UnicornMiddleware(app, some_config="rainbow") ``` But FastAPI (actually Starlette) provides a simpler way to do it that makes sure that the internal middlewares handle server errors and custom exception handlers work properly.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 4.1K bytes - Click Count (0) -
docs_src/handling_errors/tutorial003_py310.py
@app.exception_handler(UnicornException) async def unicorn_exception_handler(request: Request, exc: UnicornException): return JSONResponse( status_code=418, content={"message": f"Oops! {exc.name} did something. There goes a rainbow..."}, ) @app.get("/unicorns/{name}") async def read_unicorn(name: str): if name == "yolo": raise UnicornException(name=name)
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Feb 12 13:19:43 GMT 2026 - 626 bytes - Click Count (0) -
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()` 的第一个参数是中间件的类,其它参数则是要传递给中间件的参数。
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:06:37 GMT 2026 - 3.7K bytes - Click Count (0) -
docs/zh-hant/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()` 將中介軟體類別作為第一個引數,並接收要傳遞給該中介軟體的其他引數。
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 17:05:38 GMT 2026 - 3.9K bytes - Click Count (0) -
docs/ja/docs/advanced/middleware.md
new_app = UnicornMiddleware(app, some_config="rainbow") ``` しかし FastAPI(正確には Starlette)は、内部ミドルウェアがサーバーエラーを処理し、カスタム例外ハンドラが正しく動作することを保証する、より簡単な方法を提供しています。 そのためには(CORS の例と同様に)`app.add_middleware()` を使います。 ```Python from fastapi import FastAPI from unicorn import UnicornMiddleware app = FastAPI() app.add_middleware(UnicornMiddleware, some_config="rainbow") ```
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 14:07:17 GMT 2026 - 5.2K bytes - Click Count (0) -
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`.Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 05 18:13:19 GMT 2026 - 8.9K bytes - Click Count (0) -
docs/pt/docs/advanced/middleware.md
```Python from unicorn import UnicornMiddleware app = SomeASGIApp() new_app = UnicornMiddleware(app, some_config="rainbow") ```
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:20:43 GMT 2026 - 4.5K bytes - Click Count (0) -
docs/tr/docs/advanced/middleware.md
```Python from unicorn import UnicornMiddleware app = SomeASGIApp() new_app = UnicornMiddleware(app, some_config="rainbow") ``` Ancak FastAPI (aslında Starlette) bunu yapmanın daha basit bir yolunu sunar; böylece dahili middleware'ler server hatalarını doğru şekilde ele alır ve özel exception handler'lar düzgün çalışır.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Fri Mar 20 07:53:17 GMT 2026 - 4.6K bytes - Click Count (0) -
docs/es/docs/advanced/middleware.md
Entonces, en la documentación de middlewares ASGI de terceros probablemente te indicarán que hagas algo como: ```Python from unicorn import UnicornMiddleware app = SomeASGIApp() new_app = UnicornMiddleware(app, some_config="rainbow") ``` Pero FastAPI (en realidad Starlette) proporciona una forma más simple de hacerlo que asegura que los middlewares internos manejen errores del servidor y los controladores de excepciones personalizadas funcionen correctamente.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:15:55 GMT 2026 - 4.5K bytes - Click Count (0) -
docs/fr/docs/advanced/middleware.md
```Python from unicorn import UnicornMiddleware app = SomeASGIApp() new_app = UnicornMiddleware(app, some_config="rainbow") ``` Mais FastAPI (en fait Starlette) fournit une manière plus simple de le faire, qui garantit que les middlewares internes gèrent les erreurs serveur et que les gestionnaires d'exceptions personnalisés fonctionnent correctement.
Created: Sun Apr 05 07:19:11 GMT 2026 - Last Modified: Thu Mar 19 18:37:13 GMT 2026 - 4.7K bytes - Click Count (0)