Closed wowkmw closed 3 years ago
This will be solved when the SDK is updated with all the new releases coming out in the official API. A ton of new features are coming hard and fast so stay tuned for an update in August.
Thanks, looking forward to it!
as a workaround until this is available I just copied the method into my code with adjusted query_params
.
that seems to work fine as well, although i did notice that it does not seem to like passing a list as param value. as a workaround I'm currently passing the key with a []
suffix:
filter_ = {
"statuses[]": "Online",
"recentDeviceConnections[]": "Wireless",
}
clients = await getNetworkClients(
meraki_api.networks,
network,
total_pages="all",
perPage=1000,
**filter_,
)
this obviously only works when you only have single item lists.
I just took the array processing snippets from another Meraki function and patched the rules.
def _getNetworkClients(self, networkId: str, total_pages=1, direction="next", **kwargs):
kwargs.update(locals())
metadata = {
"tags": ["networks", "monitor", "clients"],
"operation": "getNetworkClients"
}
resource = f"/networks/{networkId}/clients"
query_params = ["t0", "timespan", "perPage", "startingAfter",
"endingBefore", "os", "statuses", "recentDeviceConnections", ]
params = {k.strip(): v for k, v in kwargs.items()
if k.strip() in query_params}
array_params = ["statuses", "recentDeviceConnections", ]
for k, v in kwargs.items():
if k.strip() in array_params:
params[f"{k.strip()}[]"] = kwargs[f"{k}"]
params.pop(k.strip())
return self._session.get_pages(metadata, resource, params, total_pages, direction)
Then I can override the built-in function as such:
meraki.Networks.getNetworkClients = _getNetworkClients
This is now updated and PyPI package updated.
The latest version of the Python Meraki API function "getNetworkClients" only covers a subset of all available official API's HTTP parameters.