开发者

Passing in **kwargs from Flex over PyAMF

开发者 https://www.devze.com 2022-12-22 16:26 出处:网络
Anyone know if it is easily possible to send **kwargs over PyAMF from NetConnection.call()? I would like it.

Anyone know if it is easily possible to send **kwargs over PyAMF from NetConnection.call()? I would like it.

I 开发者_如何学运维could write a wrapper around the actual function and expose that and perform some parsing manually to determine the kwargs to pass in, but I don't want to do that. I will just use a normal argument list in that case.


Whilst ActionScript has the *args construct (params ...) there is no equivalent to **kwargs, although if you do need to send arbitrary named arguments, then you can always send a dict as a positional argument to the service. E.g.

def some_service_function(kwargs): # <- note the lack of **
    foo = kwargs.get('foo')
    bar = kwargs.get('bar')

And the calling ActionScript:

nc.call("some_service_function", {foo: "some", bar: "thing"})
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号