Hello,
I am not JSON expert so I am looking for help.
I want to pass on a python variable to payload in JSON format.
I was trying with code below but it doesn't work. I have info that JSON submitted is wrong.
My code is:
------------------------------------------------------------------------------------------------------------------------------------
import requests
url = "https://api.meraki.com/api/v1/organizations/XXX/configTemplates"
myname = "TESTNAME"
payload = '''{
"name": myname,
"timeZone": "America/Los_Angeles"
}'''
headers = {
"Content-Type": "application/json",
"Accept": "application/json",
"X-Cisco-Meraki-API-Key": ""
}
response = requests.request('POST', url, headers=headers, data = payload)
print(response.text.encode('utf8'))
------------------------------------------------------------------------------------------------------------------------------------
Of course payload below works perfectly but I need variables to be able to pass them through argv in the future.
payload = '''{
"name": "TESTNAME",
"timeZone": "America/Los_Angeles"
}'''