Skip to content

Documentation: correct way to get client IP? #1319

Answered by Goldziher
sabard asked this question in Q&A
Discussion options

You must be logged in to vote

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.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by JacobCoffee
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Question This is a question and further information is requested
2 participants
Converted from issue

This discussion was converted from issue #1318 on March 13, 2023 23:26.