The code I am using is bellow. I'm just starting off with some API stuff. When logging into Meraki we have one Organization and a bunch of other networks under that. But when searching for the networks it prints the organization correct but for the networks I am getting a "HTTPError: 404 Client Error: Not Found for url: https://api.meraki.com/api/v1/organzations/ID/networks.
Any idea what is wrong here?
import requests
api_key = input("Enter a Key ")
def meraki_get(resource😞
headers = {
"Content": "application/json",
"X-Cisco-Meraki-API-Key": api_key
}
get_resp = requests.get(f"{api_path}/{resource}", headers=headers)
get_resp.raise_for_status()
return get_resp.json()
def main():
orgs = meraki_get("organizations")
print ("Organization Discovered")
Test_id = 0
print(Test_id)
for org in orgs:
print(f"ID: {org['id']:<6} Name: {org['name']}")
if "Test" in org ["name"]:
Test_id = org["id"]
if Test_id:
networks = meraki_get(f"organzations/{Test_id}/networks")
print(f"\nNetworks seen for AMPI org ID {Test_id}")
Test_network = ""
for network in networks:
print(f"Network ID: {network['id']} Name: {network ['name']}")
if __name__ == "__main__":
main()