05-31-2021 07:07 AM
Hi everyone,
this is more basic python, but I stuck with this problem:
When I get the data of an ssid, the response is always a dictionary ('name' : 'something, ' number' : 22...) from Meraki which is fine.
But if I want to update the ssid, it has to be done in a form of name = 'something, number = '22'...
How do you convert this?
I don't want to hard code the config, I just want to change one of the values.
Thanks and best
Fabian
Solved! Go to Solution.
05-31-2021 05:50 PM
@Philip D'AthIs correct and this is probably the easiest way to do it.
A simple for loop through networks and ssids will get you through the data you need to change. Something like the below.
nets = meraki.organizations.getOrganizationNetworks(organizationId)
for net in nets:
ssids = meraki.wireless.getNetworkWirelessSsids(net['id'])
for ssid in ssids:
if ssid['name'] == "something":
ssid.update({'psk' : 'newpassword'}) # use the update() function when working with dictionaries. #
ssidChange = meraki.wireless.updateNetworkWirelessSsid(net['id'], **ssid) # the double * (**) will unpack the dictionary and allow you to post the full dictionary as the new variables. Be careful with this as you may get a return value that won't post.
05-31-2021 04:31 PM
Iterate through the dictionary and test each row for the value you are looking for (such as SSID) and then change that one row.
05-31-2021 05:50 PM
@Philip D'AthIs correct and this is probably the easiest way to do it.
A simple for loop through networks and ssids will get you through the data you need to change. Something like the below.
nets = meraki.organizations.getOrganizationNetworks(organizationId)
for net in nets:
ssids = meraki.wireless.getNetworkWirelessSsids(net['id'])
for ssid in ssids:
if ssid['name'] == "something":
ssid.update({'psk' : 'newpassword'}) # use the update() function when working with dictionaries. #
ssidChange = meraki.wireless.updateNetworkWirelessSsid(net['id'], **ssid) # the double * (**) will unpack the dictionary and allow you to post the full dictionary as the new variables. Be careful with this as you may get a return value that won't post.
05-31-2021 11:02 PM
The **ssid and ssid.update did the trick, this is awsome, thank you guys 🙂
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide