-
Notifications
You must be signed in to change notification settings - Fork 48
RpcProxy
Weitian Leung edited this page Mar 18, 2020
·
2 revisions
class RpcProxy(builtins.object)
| RpcProxy(obj, use_exception=False)
The RpcProxy enable you access the attributes that need to call the RPC get_XXX and put_XXX easily:
-
hr, visible = app.get_Visible()
becomesvisible = app.Visible
-
hr = app.put_Visible(True)
becomesapp.Visible = True
and, the RpcProxy can deduce the hr return value to Exception or a boolean. It also helps you call Release automatically to avoid memory leaks.
Most of the time, you need explicit call only for the application object. The other call will auto wrapped as a RpcProxy object:
app = RpcProxy(rpc.getWpsApplication())
To enable exception when call failed, pass use_exception as True to the RpcProxy constructor.
To access the original object:
app.rpc_object
To get the previous call result:
app.last_error
The RpcProxy will call Release when itself deleted, so you should take a care if it right, otherwise you have to call AddRef to avoid the object freed.