Some Images service functions take an RPC object argument to alter how the application communicates with the Images service. Also, asynchronous Images service functions return RPC objects to represent pending requests.
An application can alter request behavior, setting a deadline time or
a callback function. To do this, the application calls the
create_rpc()
function. This function returns an RPC object; the application then passes
this to an Images function.
Note: Don't use an RPC object for more than one request; each request needs its own.
This class is provided by the
google.appengine.api.images
module.
An RPC object has the following methods:
- wait ()
-
Waits for the request in progress to complete, invokes the RPC callback function (if any) and then returns.
If the request has already completed by the time the method is called, the method calls the callback function (if any) and returns immediately. The request is complete when the remote host successfully returns a response, the deadline elapses, or the request fails for another reason.
If
wait()
has already been called for this RPC object, a subsequent call does nothing. The callback function is not called again. - check_success ()
-
Calls wait() , then checks whether the request got a response successfully. If the deadline elapsed, or if the request failed, this method raises an appropriate exception.
- get_result ()
-
Calls
check_success()
(which in turn calls thewait()
method), then returns an object containing the response data.The call to
check_success()
raises an exception if the deadline elapsed or if the request failed.get_result()
propagates this exception to the caller.
The object has the following properties:
- callback
-
The callback function. You can modify this property after the object has been created to use a callback function that can refer to the RPC object, such as to call
get_result()
. - deadline
-
The deadline for the request. This property is read-only.