Python updateDeviceSwitchPort get data from and exported JSON

Solved
damienleick
Getting noticed

Python updateDeviceSwitchPort get data from and exported JSON

Hi,

here is my question

 

Actually a i made a python script to export a full ports configuration of switch, stored those json data and i would like to uses those data tu push ports configuration to another switch of the same model 

 

 

serial = input('Enter the serial number of the switch to backup: ')
Switch_export = dashboard.switch_ports.getDeviceSwitchPorts(serial)
print (Switch_export)
print(fThe switch port information has been stored')

serial2 = input("Please enter de serial of the destination switch : ")

i=1

for port in Switch_export:
    Switch_import = dashboard.switch_ports.updateDeviceSwitchPort(serial2, i, )
    i = i+1

print('The switch port information has been restored')


Because API doenst purpose to pussh all the configuration with one command i need to do a for with JSON data
 
Is there any possibilty to use json data port value of "Switch_export" in the "Switch_imports" arguments without need to use a Csv reader ?
 
thanks
1 Accepted Solution
damienleick
Getting noticed

Nevermind I found how to do that

View solution in original post

1 Reply 1
damienleick
Getting noticed

Nevermind I found how to do that

Get notified when there are additional replies to this discussion.