Bases: object
The base class for all RPC Contexts. Holds all information about the current state of execution of a remote procedure call.
The parent application.
Auxiliary-method specific context. You can use this to share data between auxiliary sessions. This is not set in primary contexts.
The time the rpc operation was completed in seconds-since-epoch format.
Useful for benchmarking purposes.
The time the rpc operation was initiated in seconds-since-epoch format.
Useful for benchmarking purposes.
The :class:MethodDescriptor object representing the current method. It is only set when the incoming request was successfully mapped to a method in the public interface. The contents of this property should not be changed by the user code.
Event-specific context. Use this as you want, preferably only in events, as you’d probably want to separate the event data from the method data.
When this is set, no new attribute can be added to this class instance. This is mostly for internal use.
The callable of the user code.
Incoming body document of the request.
Incoming document, what you get when you parse the incoming stream.
Native python error object. If this is set, either there was a parsing error or the incoming document was representing an exception.
Deserialized incoming header – a native object.
Incoming header document of the request.
In the request (i.e. server) case, this contains the function argument sequence for the function in the service definition class. In the response (i.e. client) case, this contains the object returned by the remote procedure call.
The order of the argument sequence is in line with self.descriptor.in_message._type_info.keys().
Incoming bytestream as a sequence of str or bytes instances.
The locale the request will use when needed for things like date formatting, html rendering and such.
The public name of the method the method_request_string was matched to.
This is used to decide which native method to call. It is set by the protocol classes.
Serialized body object.
out_body_doc and out_header_doc wrapped in the outgoing envelope
Native exception thrown by the function in the service definition class.
Native python object set by the function in the service definition class.
Serialized header object.
In the response (i.e. server) case, this contains the native python object(s) returned by the function in the service definition class. In the request (i.e. client) case, this contains the function arguments passed to the function call wrapper.
The order of the argument sequence is in line with self.descriptor.out_message._type_info.keys().
Outgoing bytestream (i.e. a sequence of strings)
The protocol-specific context. Protocol implementors can use this to their liking.
The service definition class the method belongs to.
The transport-specific context. Transport implementors can use this to their liking.
The user defined context. Use it to your liking.
Bases: object
This class represents the method signature of an exposed service. It is produced by the spyne.decorator.srpc() decorator.
Value to indicate what kind of auxiliary method this is. (None means primary)
Primary methods block the request as long as they’re running. Their return values are returned to the client. Auxiliary ones execute asyncronously after the primary method returns, and their return values are ignored by the rpc layer.
One of (BODY_STYLE_EMPTY, BODY_STYLE_BARE, BODY_STYLE_WRAPPED).
The identifier of this method in its parent spyne.service.ServiceBase subclass.
The function docstring.
An iterable of spyne.model.fault.Fault subclasses to denote the types of exceptions that this method can throw.
An iterable of spyne.model.complex.ComplexModel subclasses to denote the types of header objects that this method can accept.
A spyne.model.complex.ComplexModel subclass that defines the input signature of the user function and that was automatically generated by the @srpc decorator.
The function identifier in ‘{namespace}name’ form.
The public name of the function. Equals to the type_name of the in_message.
no_ctx: Boolean flag to denote whether the user code gets an implicit spyne.MethodContext instance as first argument.
An iterable of spyne.model.complex.ComplexModel subclasses to denote the types of header objects that this method can emit along with its return value.
A spyne.model.complex.ComplexModel subclass that defines the output signature of the user function and that was automatically generated by the @srpc decorator.
This list stores patterns which will match this callable using various elements of the request protocol.
Currently, the only object supported here is the spyne.protocol.http.HttpPattern object.
Short for “User Defined Properties”, this is just an arbitrary python object set by the user to pass arbitrary metadata via the @srpc decorator.
Spyne supports a simple event system that can be used to have repetitive boiler plate code that has to run for every method call nicely tucked away in one or more event handlers. The popular use-cases include things like database transaction management, logging and measuring performance.
Various Spyne components support firing events at various stages during the processing of the request, which are documented in the relevant classes.
The events are stored in an ordered set. This means that the events are ran in the order they were added and adding a handler twice does not cause it to run twice.
Register a handler for the given event name.
Parameters: |
|
---|
Run all the handlers for a given event name.
Parameters: |
|
---|