@EricR I just went through the code and ran this on my lab, and this code works. The apiKey import is just a library to hold my API key, nothing more. I haven't included the error checking that you had, but it returns the certificate as expected.
import requests
import apiKey
myMerakiOrg = "Demo Organisation"
headers = {
'X-Cisco-Meraki-API-Key': apiKey.key,
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.get(apiBase + "/organizations", headers = headers)
orgs = response.json()
for org in orgs:
if org["name"] == myMerakiOrg:
merakiOrgId = org["id"]
response = requests.get(apiBase + "/organizations/" + merakiOrgId + "/sm/apnsCert", headers = headers)
print(response.text)
p.s. thanks for the tip about .json()