EndpointContext
This class is a TypedDict that defines the structure for capturing the source location and function name associated with a specific endpoint. It provides optional fields for the function name, file path, and specific line number to assist in debugging and tracing endpoint execution.
Attributes
| Attribute | Type | Description |
|---|---|---|
| function | string | The name of the function or method associated with the endpoint. |
| path | string | The URL path pattern or route identifier for the endpoint. |
| file | string | The absolute or relative file path where the endpoint is defined. |
| line | integer | The specific line number within the source file where the endpoint definition begins. |
Constructor
Signature
def EndpointContext(
function: str,
path: str,
file: str,
line: int
) - > None
Parameters
| Name | Type | Description |
|---|---|---|
| function | str | The name of the function associated with the endpoint. |
| path | str | The URL path for the endpoint. |
| file | str | The file path where the endpoint is defined. |
| line | int | The line number in the file where the endpoint definition begins. |
Methods
function()
def function() - > str
The name of the function or method that handles the specific API endpoint logic.
Returns
| Type | Description |
|---|---|
str | The function name string. |
path()
def path() - > str
The URL path pattern associated with the endpoint, used for routing and identification.
Returns
| Type | Description |
|---|---|
str | The relative or absolute URL path. |
file()
def file() - > str
The absolute or relative file system path to the source code file where the endpoint is defined.
Returns
| Type | Description |
|---|---|
str | The source file path. |
line()
def line() - > int
The specific line number within the source file where the endpoint function definition begins.
Returns
| Type | Description |
|---|---|
int | The integer line number. |