THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
class documentation
class FileResponse(StreamingResponse): (source)
Constructor: FileResponse(path, status_code, headers, media_type, ...)
Undocumented
| Method | __init__ |
Initialize a file streaming response. |
| Async Method | _file |
Yield file content in chunks asynchronously. |
| Method | get |
Return the file size in bytes. |
| Method | get |
Return the file path. |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | _chunk |
Undocumented |
| Instance Variable | _file |
Undocumented |
| Instance Variable | _path |
Undocumented |
Inherited from StreamingResponse:
| Async Method | _wrap |
Adapt a synchronous iterable of bytes to an asynchronous iterable. |
| Instance Variable | _body |
Undocumented |
Inherited from Response (via StreamingResponse):
| Method | add |
Add a header to the response. |
| Method | delete |
Delete a cookie by setting its expiration to the past. |
| Method | get |
Return the response body as bytes. |
| Method | get |
Return the data queued by withFlash() for the session flash bag. |
| Method | get |
Get the values for a header. |
| Method | get |
Return the media type of the response. |
| Method | get |
Return the headers as a list of (key, value) byte tuples. |
| Method | get |
Return the HTTP status code of the response. |
| Method | get |
Return the response stream if present. |
| Method | get |
Return the headers as a list of (key, value) string tuples. |
| Method | has |
Check if a header is present. |
| Method | has |
Check if the response has a stream. |
| Method | remove |
Remove a header from the response. |
| Method | render |
Render the content to bytes. |
| Async Method | run |
Run the background task if it exists. |
| Method | set |
Set a cookie header in the response. |
| Method | set |
Set a header, replacing any existing values. |
| Method | with |
Attach a cookie and return the response for chaining. |
| Method | with |
Attach several cookies at once and return the response. |
| Method | with |
Flash validation errors for the next request. |
| Method | with |
Flash a status message into the session and return the response. |
| Method | with |
Flash the submitted payload so the next request can repopulate it. |
| Method | without |
Expire a cookie and return the response for chaining. |
| Class Variable | charset |
Undocumented |
| Instance Variable | _flash |
Undocumented |
| Instance Variable | _headers |
Undocumented |
| Instance Variable | _raw |
Undocumented |
| Instance Variable | _stream |
Undocumented |
| Instance Variable | background |
Undocumented |
| Instance Variable | media |
Undocumented |
| Instance Variable | status |
Undocumented |
def __init__(self, path:
str | Path, status_code: int = 200, headers: Mapping[ str, str] | None = None, media_type: str | None = None, filename: str | None = None, chunk_size: int = 64 * 1024, background: BackgroundTask | None = None):
(source)
¶
overrides
orionis.http.StreamingResponse.__init__Initialize a file streaming response.
| Parameters | |
path:str | Path | Path to the file to serve. |
statusint, default 200 | HTTP status code for the response. |
headers:Mapping[str, str] | None, optional | Optional response headers. |
mediastr | None, optional | Optional media type for the response. |
filename:str | None, optional | Optional filename for Content-Disposition header. |
chunkint, default 65536 | Size of file chunks to read and send. |
background:BackgroundTask | None, optional | Optional background task to run after response. |
| Returns | |
None | This constructor does not return a value. |
Yield file content in chunks asynchronously.
| Returns | |
AsyncIterable[bytes] | An asynchronous iterable yielding file chunks as bytes. |