Hey, So, I've simplified an existing script I have. It takes a CSV with the following headers: networkId,SSIDName, VLAN import meraki
import logging, sys, getopt
import pandas as pd
# Ingests a CSV file with the following headers:
# networkId, SSIDName, VLAN
def main(argv):
print(meraki.__version__)
try:
opts, args = getopt.getopt(argv, 'k:o:')
except getopt.GetOptError:
sys.exit(2)
for opt, arg in opts:
if opt == '-k':
arg_apikey = arg
elif opt == '-o':
arg_org_id = arg
if arg_apikey == '' or arg_org_id == '':
sys.exit(2)
client = meraki.DashboardAPI(api_key=arg_apikey)
APData = pd.read_csv("CSV-Networks.csv")
for index, row in APData.iterrows():
SSIDInfo = row.to_dict()
networkID = SSIDInfo["networkId"]
SSIDName = SSIDInfo["SSIDName"]
SSIDVLAN = int(SSIDInfo["VLAN"])
SSIDNPSK = "5656565656"
try:
setSSID = client.wireless.updateNetworkWirelessSsid(networkId=networkID,
number="2",
enabled=True,
name=SSIDName,
encryptionMode="wpa",
useVlanTagging=True,
defaultVlanId=SSIDVLAN,
authMode="psk",
ipAssignmentMode="Bridge mode",
psk=SSIDNPSK,
availableOnAllAps=False,
availabilityTags=[SSIDName])
except meraki.APIError as e:
print(e.message)
if __name__ == '__main__':
main(sys.argv[1:]) It uses the following python Libraries: Pandas : For reading multi column CSVs and Meraki : Makes using the API so much easier and it takes the following arguments: -o yourOrgID -k yourAPI key I hope that this helps....
... View more