Package remoting
source code
AMF Remoting support.
A Remoting request from the client consists of a short preamble,
headers, and bodies. The preamble contains basic information about the
nature of the request. Headers can be used to request debugging
information, send authentication info, tag transactions, etc. Bodies
contain actual Remoting requests and responses. A single Remoting
envelope can contain several requests; Remoting supports batching out of
the box.
Client headers and bodies need not be responded to in a one-to-one
manner. That is, a body or header may not require a response. Debug
information is requested by a header but sent back as a body object. The
response index is essential for the Flash Player to understand the
response therefore.
|
RemotingError
Generic remoting error class.
|
|
RemotingCallFailed
Raised if Server.Call.Failed received.
|
|
HeaderCollection
Collection of AMF message headers.
|
|
Envelope
I wrap an entire request, encapsulating headers and bodies.
|
|
Message
I represent a singular request/response, containing a collection of
headers and one body of data.
|
|
Request
An AMF Request payload.
|
|
Response
An AMF Response.
|
|
BaseFault
I represent a Fault message
(mx.rpc.Fault ).
|
|
ErrorFault
I represent an error level fault.
|
tuple
|
|
|
|
tuple
|
|
|
|
|
|
|
|
|
|
Envelope
|
|
StringIO
|
encode(msg,
context=None,
strict=False)
Encodes AMF stream and returns file object. |
source code
|
|
|
|
|
STATUS_OK = 0
Succesful call.
|
|
STATUS_ERROR = 1
Reserved for runtime errors.
|
|
STATUS_DEBUG = 2
Debug information.
|
|
STATUS_CODES = { 0: ' /onResult ' , 1: ' /onStatus ' , 2: ' /onDebugEv ...
List of available status response codes.
|
|
CONTENT_TYPE = ' application/x-amf '
AMF mimetype.
|
|
ERROR_CODES = { 0: ' Server.Call.Failed ' }
|
|
APPEND_TO_GATEWAY_URL = ' AppendToGatewayUrl '
|
|
REPLACE_GATEWAY_URL = ' ReplaceGatewayUrl '
|
|
REQUEST_PERSISTENT_HEADER = ' RequestPersistentHeader '
|
|
ERROR_CALL_FAILED = 0
|
Imports:
copy,
pyamf,
util
_read_header(stream,
decoder,
strict=False)
| source code
|
Read AMF Message header.
- Parameters:
- Returns:
tuple
-
Name of the header.
-
A
bool determining if understanding this header
is required.
-
Value of the header.
- Raises:
DecodeError - The data that was read from the stream does not match the header
length.
|
_write_header(name,
header,
required,
stream,
encoder,
strict=False)
| source code
|
Write AMF message header.
- Parameters:
name (str ) - Name of the header.
header () - Raw header data.
required (bool ) - Required header.
stream (BufferedByteStream) - AMF data.
encoder (amf0.Encoder or amf3.Encoder) - AMF encoder instance.
strict (bool ) - Use strict encoding policy. Default is False .
|
Read AMF message body.
- Parameters:
- Returns:
tuple
- A
tuple containing:
- Raises:
DecodeError - Data read from stream does not match body length.
|
_write_body(name,
message,
stream,
encoder,
strict=False)
| source code
|
Write AMF message body.
- Parameters:
- Raises:
TypeError - Unknown message type for message .
|
Get status code.
- Parameters:
- Returns:
- Status code.
- Raises:
ValueError - The status code is unknown.
|
Decodes the incoming stream.
- Parameters:
- Returns: Envelope
- Message envelope.
- Raises:
DecodeError - Malformed stream.
RuntimeError - Decoder is unable to fully consume the stream buffer.
|
Encodes AMF stream and returns file object.
- Parameters:
msg (Envelope) - The message to encode.
context (amf0.Context or amf3.Context) - Context.
strict (bool ) - Determines whether encoding should be strict. Specifically
header/body lengths will be written correctly, instead of the
default 0. Default is False . Introduced in 0.4.
- Returns:
StringIO
- File object.
|
STATUS_CODES
List of available status response codes.
- Value:
{ 0: ' /onResult ' , 1: ' /onStatus ' , 2: ' /onDebugEvents ' }
|
|