StreamMessage
faststream.broker.fastapi.StreamMessage #
StreamMessage(
body: Optional[AnyDict] = None,
headers: Optional[AnyDict] = None,
path: Optional[AnyDict] = None,
)
Bases: Request
A class to represent a stream message.
METHOD | DESCRIPTION |
---|---|
__init__ | initializes the StreamMessage object |
get_session | returns a callable function that handles the session of the message |
Note
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
Initialize a class instance.
PARAMETER | DESCRIPTION |
---|---|
body | The body of the request as a dictionary. Default is None. TYPE: |
headers | The headers of the request as a dictionary. Default is None. TYPE: |
Note
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)
Source code in faststream/broker/fastapi/route.py
body async
#
close async
#
form #
form(
*,
max_files: typing.Union[int, float] = 1000,
max_fields: typing.Union[int, float] = 1000
) -> AwaitableOrContextManager[FormData]
Source code in starlette/requests.py
get_session classmethod
#
get_session(
dependant: Dependant,
dependency_overrides_provider: Optional[Any] = None,
) -> Callable[
[NativeMessage[Any]], Awaitable[SendableMessage]
]
Creates a session for handling requests.
PARAMETER | DESCRIPTION |
---|---|
dependant | The dependant object representing the session. TYPE: |
dependency_overrides_provider | Optional provider for dependency overrides. |
RETURNS | DESCRIPTION |
---|---|
Callable[[StreamMessage[Any]], Awaitable[SendableMessage]] | A callable that takes a native message and returns an awaitable sendable message. |
RAISES | DESCRIPTION |
---|---|
AssertionError | If the dependant call is not defined. |
Note
This function is used to create a session for handling requests. It takes a dependant object, which represents the session, and a dependency overrides provider, which allows for overriding dependencies. It returns a callable that takes a native message and returns an awaitable sendable message. The session is created based on the dependant object and the message passed to the callable. The session is then used to call the function obtained from the dependant object, and the result is returned.
Note
The above docstring is autogenerated by docstring-gen library (https://docstring-gen.airt.ai)