lukecyca/pyzabbix — pull request #39 by dmiyakawa (2014-05-28 05:11:08+00:00)
Title: Allow users to use pure dictionary for param.

PyZabbix allows this kind of arguments:

result = zapi.host.get(output'='extend',
filter={'host': host})

This is useful enough, while sometimes it will be
more helpful if it accepts a dict.

E.g.

result = zapi.host.get({'output': 'extend',
'filter': {'host': host}})

Current implementation does accept this style
but it will be parsed as a tuple containing the
dict, so Zabbix API will just ignores that part.

PyZabbix's log will show something like this:

Sending: {'params': ({'filter': {'host': 'mugi.in.mokha.co.jp'},
'output': 'extend'},), 'jsonrpc': '2.0', 'method': 'host.get', 'auth':
'68ba....636303', 'id': 2}

This change will remove the tuple part only when it is sure
the content is a single dict.