Copy SSID with Python Library

KarstenI
Kind of a big deal
Kind of a big deal

Copy SSID with Python Library

Hi all,

 

I want to read an SSID from one network and push it to another.

When reading it, I get an object/dict like the following:

{'authMode': '8021x-radius',
 'availabilityTags': [],
 'availableOnAllAps': True,
 'bandSelection': 'Dual band operation',
 'defaultVlanId': 999,
 'dot11r': {'adaptive': False, 'enabled': False},
 'dot11w': {'enabled': True, 'required': True},
 'enabled': True,
 'encryptionMode': 'wpa-eap',
 'ipAssignmentMode': 'Bridge mode',
...
 'splashPage': 'None',
 'ssidAdminAccessible': False,
 'useVlanTagging': True,
 'visible': True,
 'wpaEncryptionMode': 'WPA2 only'}

 

but to push it, the API wants all elements individually:

response = dashboard.wireless.updateNetworkWirelessSsid(
    network_id, number, 
    name='My SSID', 
    enabled=True, 
    authMode='8021x-radius', 
    enterpriseAdminAccess='access enabled', 
    encryptionMode='wpa', 
    psk='deadbeef', 
    wpaEncryptionMode='WPA2 only', 
...
)

 

This problem is more based on my miserable programming skills, but how do I pass this source dictionary to the API call?

4 Replies 4
DarrenOC
Kind of a big deal
Kind of a big deal

Sorry I can’t help but glad to see that I’m not the only one struggling when it comes to APIs and Python.  Just not something I do day in and day out.

Darren OConnor | doconnor@resalire.co.uk
https://www.linkedin.com/in/darrenoconnor/

I'm not an employee of Cisco/Meraki. My posts are based on Meraki best practice and what has worked for me in the field.
KarstenI
Kind of a big deal
Kind of a big deal

Thanks for your mental support ... 😉

KarstenI
Kind of a big deal
Kind of a big deal

I only had to go to page 5 on my Google search ...

https://community.meraki.com/t5/Developers-APIs/Python-dictionary-to-list/m-p/119919

 

source_ssid.pop('number')
response = dashboard.wireless.updateNetworkWirelessSsid(
    dest_network_id, dest_ssid_number, **source_ssid
    )

Unpacking the dictionary is the key. Okay, now to the subsequent errors ...

alemabrahao
Kind of a big deal
Kind of a big deal

I'm not expert in python, but maybe it can help you.

 

https://github.com/rmceoin/meraki

I am not a Cisco Meraki employee. My suggestions are based on documentation of Meraki best practices and day-to-day experience.

Please, if this post was useful, leave your kudos and mark it as solved.
Get notified when there are additional replies to this discussion.