Package pyamf :: Package remoting :: Package client :: Class RemotingService |
[hide private]
[frames] | no frames]

# Class RemotingService

source code

Acts as a client for AMF calls.

Instance Methods | [hide private]
__init__(self, url, amf_version=0, client_type=0, referer=None, user_agent=`'``PyAMF/0.5.1``'`, strict=False, logger=None) x.__init__(...) initializes x; see x.__class__.__doc__ for signature | source code
_setUrl(self, url) | source code
addHeader(self, name, value, must_understand=False) Sets a persistent header to send with each request. | source code
addHTTPHeader(self, name, value) Adds a header to the underlying HTTP connection. | source code
removeHTTPHeader(self, name) Deletes an HTTP header. | source code
ServiceProxy |
getService(self, name, auto_execute=True) Returns a ServiceProxy for the supplied name. | source code
getRequest(self, id_) Gets a request based on the id. | source code
addRequest(self, service, *args) Adds a request to be sent to the remoting gateway. | source code
removeRequest(self, service, *args) Removes a request from the pending request list. | source code
Envelope |
getAMFRequest(self, requests) Builds an AMF request Envelope from a supplied list of requests. | source code
_get_execute_headers(self) | source code
execute_single(self, request) Builds, sends and handles the response to a single request, returning the response. | source code
execute(self) Builds, sends and handles the responses to all requests listed in `self.requests`. | source code
_getResponse(self) Gets and handles the HTTP response from the remote gateway. | source code
setCredentials(self, username, password) Sets authentication credentials for accessing the remote gateway. | source code
Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Instance Variables | [hide private]
`int` | amf_version The AMF version to use.
`int` | client_type The client type.
`httplib.HTTPConnection` or `httplib.HTTPSConnection` | connection The underlying connection to the remoting server.
HeaderCollection | headers A list of persistent headers to send with each request.
`dict` | http_headers A dict of HTTP headers to apply to the underlying HTTP connection.
`str` | referer The referer, or HTTP referer, identifies the address of the client.
| request_number A unique identifier for tracking the number of requests.
`list` | requests The list of pending requests to process.
`bool` | strict Whether to use strict AMF en/decoding or not.
`str` | url The url of the remote gateway.
`str` | user_agent Contains information about the user agent (client) originating the request.

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, url, amf_version=0, client_type=0, referer=None, user_agent=`'``PyAMF/0.5.1``'`, strict=False, logger=None) (Constructor) | source code
x.__init__(...) initializes x; see x.__class__.__doc__ for signature Overrides: object.__init__ (inherited documentation)

### _setUrl(self, url) | source code
Parameters: `url` (`str`) - Gateway URL. Raises: `ValueError` - Unknown scheme.

### addHeader(self, name, value, must_understand=False) | source code
Sets a persistent header to send with each request. Parameters: `name` (`str`) - Header name. `must_understand` (`bool`) - Default is `False`.

### getService(self, name, auto_execute=True) | source code
Returns a ServiceProxy for the supplied name. Sets up an object that can have method calls made to it that build the AMF requests. Parameters: `auto_execute` (`bool`) - Default is `True`. Returns: ServiceProxy Raises: `TypeError` - `string` type required for `name`.

### getRequest(self, id_) | source code
Gets a request based on the id. Raises: `LookupError` - Request not found.

### removeRequest(self, service, *args) | source code
Removes a request from the pending request list. Raises: `LookupError` - Request not found.

### getAMFRequest(self, requests) | source code
Builds an AMF request Envelope from a supplied list of requests. Parameters: `requests` (`list`) - List of requests Returns: Envelope

### execute_single(self, request) | source code
Builds, sends and handles the response to a single request, returning the response. Parameters: `request` ()

### _getResponse(self) | source code
Gets and handles the HTTP response from the remote gateway. Raises: `RemotingError` - HTTP Gateway reported error status. `RemotingError` - Incorrect MIME type received.

Instance Variable Details | [hide private]

### amf_version The AMF version to use. See ENCODING_TYPES. Type: `int`

### client_type The client type. See ClientTypes. Type: `int`

### referer The referer, or HTTP referer, identifies the address of the client. Ignored by default. Type: `str`

### url The url of the remote gateway. Accepts `http` or `https` as valid schemes. Type: `str`

### user_agent Contains information about the user agent (client) originating the request. See DEFAULT_USER_AGENT. Type: `str`