Module spin_sdk.wit.exports

Sub-modules

spin_sdk.wit.exports.fermyon_spin_inbound_redis
spin_sdk.wit.exports.http_handler

This interface defines a handler of HTTP Requests …

spin_sdk.wit.exports.redis_handler
spin_sdk.wit.exports.wasi_http_incoming_handler_0_2_0

This interface defines a handler of incoming HTTP Requests. It should be exported by components which can respond to HTTP Requests.

Classes

class FermyonSpinInboundRedis (*args, **kwargs)
Expand source code
class FermyonSpinInboundRedis(Protocol):

    @abstractmethod
    def handle_message(self, message: bytes) -> None:
        """
        The entrypoint for a Redis handler.
        
        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_types.Error)`
        """
        raise NotImplementedError

Base class for protocol classes.

Protocol classes are defined as::

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).

For example::

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::

class GenProto[T](Protocol):
    def meth(self) -> T:
        ...

Ancestors

  • typing.Protocol
  • typing.Generic

Methods

def handle_message(self, message: bytes) ‑> None
Expand source code
@abstractmethod
def handle_message(self, message: bytes) -> None:
    """
    The entrypoint for a Redis handler.
    
    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.fermyon_spin_redis_types.Error)`
    """
    raise NotImplementedError

The entrypoint for a Redis handler.

Raises: componentize_py_types.Err(Error)

class HttpHandler (*args, **kwargs)
Expand source code
class HttpHandler(Protocol):

    @abstractmethod
    async def handle(self, request: wasi_http_types_0_3_0_rc_2026_03_15.Request) -> wasi_http_types_0_3_0_rc_2026_03_15.Response:
        """
        This function may be called with either an incoming request read from the
        network or a request synthesized or forwarded by another component.
        
        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.ErrorCode)`
        """
        raise NotImplementedError

Base class for protocol classes.

Protocol classes are defined as::

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).

For example::

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::

class GenProto[T](Protocol):
    def meth(self) -> T:
        ...

Ancestors

  • typing.Protocol
  • typing.Generic

Subclasses

Methods

async def handle(self,
request: Request) ‑> Response
Expand source code
@abstractmethod
async def handle(self, request: wasi_http_types_0_3_0_rc_2026_03_15.Request) -> wasi_http_types_0_3_0_rc_2026_03_15.Response:
    """
    This function may be called with either an incoming request read from the
    network or a request synthesized or forwarded by another component.
    
    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.wasi_http_types_0_3_0_rc_2026_03_15.ErrorCode)`
    """
    raise NotImplementedError

This function may be called with either an incoming request read from the network or a request synthesized or forwarded by another component.

Raises: componentize_py_types.Err(ErrorCode)

class RedisHandler (*args, **kwargs)
Expand source code
class RedisHandler(Protocol):

    @abstractmethod
    async def handle_message(self, message: bytes) -> None:
        """
        The entrypoint for a Redis handler.
        
        Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
        """
        raise NotImplementedError

Base class for protocol classes.

Protocol classes are defined as::

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).

For example::

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::

class GenProto[T](Protocol):
    def meth(self) -> T:
        ...

Ancestors

  • typing.Protocol
  • typing.Generic

Methods

async def handle_message(self, message: bytes) ‑> None
Expand source code
@abstractmethod
async def handle_message(self, message: bytes) -> None:
    """
    The entrypoint for a Redis handler.
    
    Raises: `componentize_py_types.Err(spin_sdk.wit.imports.spin_redis_redis_3_0_0.Error)`
    """
    raise NotImplementedError

The entrypoint for a Redis handler.

Raises: componentize_py_types.Err(Error)

class WasiHttpIncomingHandler020 (*args, **kwargs)
Expand source code
class WasiHttpIncomingHandler020(Protocol):

    @abstractmethod
    def handle(self, request: wasi_http_types_0_2_0.IncomingRequest, response_out: wasi_http_types_0_2_0.ResponseOutparam) -> None:
        """
        This function is invoked with an incoming HTTP Request, and a resource
        `response-outparam` which provides the capability to reply with an HTTP
        Response. The response is sent by calling the `response-outparam.set`
        method, which allows execution to continue after the response has been
        sent. This enables both streaming to the response body, and performing other
        work.
        
        The implementor of this function must write a response to the
        `response-outparam` before returning, or else the caller will respond
        with an error on its behalf.
        """
        raise NotImplementedError

Base class for protocol classes.

Protocol classes are defined as::

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing).

For example::

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as::

class GenProto[T](Protocol):
    def meth(self) -> T:
        ...

Ancestors

  • typing.Protocol
  • typing.Generic

Methods

def handle(self,
request: IncomingRequest,
response_out: ResponseOutparam) ‑> None
Expand source code
@abstractmethod
def handle(self, request: wasi_http_types_0_2_0.IncomingRequest, response_out: wasi_http_types_0_2_0.ResponseOutparam) -> None:
    """
    This function is invoked with an incoming HTTP Request, and a resource
    `response-outparam` which provides the capability to reply with an HTTP
    Response. The response is sent by calling the `response-outparam.set`
    method, which allows execution to continue after the response has been
    sent. This enables both streaming to the response body, and performing other
    work.
    
    The implementor of this function must write a response to the
    `response-outparam` before returning, or else the caller will respond
    with an error on its behalf.
    """
    raise NotImplementedError

This function is invoked with an incoming HTTP Request, and a resource response-outparam which provides the capability to reply with an HTTP Response. The response is sent by calling the response-outparam.set method, which allows execution to continue after the response has been sent. This enables both streaming to the response body, and performing other work.

The implementor of this function must write a response to the response-outparam before returning, or else the caller will respond with an error on its behalf.