-
FastAPI has a simple mechanism for accessing client information from the If this is easily done can an example be added to the documentation? Let me know if I'm missing something simple. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This is not FastAPI specific. This info is part of the ASGI spec and is as such accessible as part of the ASGI scope dictionary. You can access |
Beta Was this translation helpful? Give feedback.
-
Got it. I see now that |
Beta Was this translation helpful? Give feedback.
This is not FastAPI specific. This info is part of the ASGI spec and is as such accessible as part of the ASGI scope dictionary.
You can access
request.client
to access it. Simply have the request instance injected into the route handler (or the websocket instance) to interact with it.