Module spin_sdk.wit.exports
Sub-modules
spin_sdk.wit.exports.inbound_redisspin_sdk.wit.exports.incoming_handler-
This interface defines a handler of incoming HTTP Requests. It should be exported by components which can respond to HTTP Requests.
Classes
class InboundRedis (*args, **kwargs)-
Expand source code
class InboundRedis(Protocol): @abstractmethod def handle_message(self, message: bytes) -> None: """ The entrypoint for a Redis handler. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis_types.Error)` """ raise NotImplementedErrorBase 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 checkSee 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: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis_types.Error)` """ raise NotImplementedError
class IncomingHandler (*args, **kwargs)-
Expand source code
class IncomingHandler(Protocol): @abstractmethod def handle(self, request: types.IncomingRequest, response_out: types.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 NotImplementedErrorBase 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 checkSee 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
def handle(self,
request: IncomingRequest,
response_out: ResponseOutparam) ‑> None-
Expand source code
@abstractmethod def handle(self, request: types.IncomingRequest, response_out: types.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 NotImplementedErrorThis function is invoked with an incoming HTTP Request, and a resource
response-outparamwhich provides the capability to reply with an HTTP Response. The response is sent by calling theresponse-outparam.setmethod, 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-outparambefore returning, or else the caller will respond with an error on its behalf.