Skip to main content

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

AttributeTypeDescription
functionstringThe name of the function or method associated with the endpoint.
pathstringThe URL path pattern or route identifier for the endpoint.
filestringThe absolute or relative file path where the endpoint is defined.
lineintegerThe 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

NameTypeDescription
functionstrThe name of the function associated with the endpoint.
pathstrThe URL path for the endpoint.
filestrThe file path where the endpoint is defined.
lineintThe 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

TypeDescription
strThe function name string.

path()

def path() - > str

The URL path pattern associated with the endpoint, used for routing and identification.

Returns

TypeDescription
strThe 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

TypeDescription
strThe source file path.

line()

def line() - > int

The specific line number within the source file where the endpoint function definition begins.

Returns

TypeDescription
intThe integer line number.