I'm having a problem appending the new rule list to the existing list :(| I think its because I have created the existing rule list as a dictionary. However if I try to re-write the dictionary as a list (with square brackets [] ) the code stops working. "Invalid syntax" import requests import security import json # Replace with your Meraki API key and network ID api_key = security.MERAKI_API_KEY organizationId = security.ORG_ID network_id = "xxxxxxxxxxxxxxxxx" url = f"https://api.meraki.com/api/v1/networks/ { network_id } /appliance/firewall/l3FirewallRules" headers = { 'X-Cisco-Meraki-API-Key' : api_key , 'Content-Type' : 'application/json' } response = requests.get(url , headers =headers , verify = False ) existingrules = response.json() print (response.status_code) print (response.text.encode( 'utf8' )) with open ( 'ExistingRules.json' , 'w' ) as json_file: json.dump(response.json() , json_file , indent = 4 ) newrule = '''{ "rules": [ { "comment": "Test RuleNEW.", "policy": "deny", "protocol": "any", "destPort": "any", "destCidr": "192.200.1.0/24", "srcPort": "Any", "srcCidr": "Any", "syslogEnabled": false } ] }''' existingrules.append(newrule) response = requests.put(url , headers =headers , json =existingrules , verify = False )
... View more