Request
クラス¶
パスオペレーション関数または依存関係で、パラメータをRequest
型として宣言できます。その後、検証などを行わずに、生のリクエストオブジェクトに直接アクセスできます。
fastapi
から直接インポートできます。
from fastapi import Request
ヒント
HTTPとWebSocketsの両方に対応する依存関係を定義する場合は、Request
またはWebSocket
の代わりにHTTPConnection
を受け取るパラメータを定義できます。
fastapi.Request ¶
Request(scope, receive=empty_receive, send=empty_send)
ベース:HTTPConnection
パラメータ | 説明 |
---|---|
scope
|
型: |
receive
|
型: |
send
|
型: |
starlette/requests.py
のソースコード
194 195 196 197 198 199 200 201 |
|
url_for ¶
url_for(name, /, **path_params)
パラメータ | 説明 |
---|---|
名前
|
型: |
**path_params**
|
型: |
starlette/requests.py
のソースコード
177 178 179 180 |
|
stream 非同期
¶
stream()
starlette/requests.py
のソースコード
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
|
body 非同期
¶
body()
starlette/requests.py
のソースコード
231 232 233 234 235 236 237 |
|
json 非同期
¶
json()
starlette/requests.py
のソースコード
239 240 241 242 243 |
|
form ¶
form(*, max_files=1000, max_fields=1000)
パラメータ | 説明 |
---|---|
最大ファイル数
|
型: |
最大フィールド数
|
型: |
starlette/requests.py
のソースコード
273 274 275 276 |
|
close 非同期
¶
close()
starlette/requests.py
のソースコード
278 279 280 |
|
is_disconnected 非同期
¶
is_disconnected()
starlette/requests.py
のソースコード
282 283 284 285 286 287 288 289 290 291 292 293 294 |
|
send_push_promise 非同期
¶
send_push_promise(path)
パラメータ | 説明 |
---|---|
パス
|
型: |
starlette/requests.py
のソースコード
296 297 298 299 300 301 302 |
|