cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6806
Views
13
Helpful
13
Replies

Need Help - Meraki GET API - SSL Errors

Lalana
Cisco Employee
Cisco Employee

Hi Team,

We are getting the following errors for the Meraki API endpoint GET calls. I am posting some of the sample calls here.

WARNING - organizations, getOrganization > https://api.meraki.com/api/v1/organizations/1413157 - Cannot connect to host api.meraki.com:443 ssl:default [Network is unreachable], retrying in 1 second
WARNING - organizations, getOrganization > https://api.meraki.com/api/v1/organizations/1413157 - Cannot connect to host api.meraki.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)')], retrying in 1 second
WARNING - organizations, getOrganization > https://api.meraki.com/api/v1/organizations/1413157 - Cannot connect to host api.meraki.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:997)')], retrying in 1 second

can anyone help to resolve this issue?

Thanks & Regards,
Lalana
13 Replies 13

KH6
Cisco Employee
Cisco Employee

Hey @Lalana

I am curious how/what method is used to run these calls. Meraki uses the API key for authentication and not any kind of certificate so it sounds like whatever application you are using is the problem. Can you run the same API call using Postman or in the browser?

If you found this post helpful, please give it kudos. If my answer solved your problem, click "accept as solution" so that others can benefit from it

Lalana
Cisco Employee
Cisco Employee

Hi KH,

From postman it works fine, we are using a python script which uses async api calls, pasting the code snippet here:

async def main_async(api_key, ORG_ID, operations, tag😞
global DEVICES, NETWORKS, TEMPLATES
async with meraki.aio.AsyncDashboardAPI(api_key, maximum_concurrent_requests=1, maximum_retries=4,
print_console=True, suppress_logging=False) as dashboard:
# Backup org
await asyncio.gather(backup_org(dashboard, ORG_ID, operations), backup_devices(dashboard, ORG_ID, operations, DEVICES), backup_networks(dashboard, ORG_ID, operations, NETWORKS + TEMPLATES), backup_mr_ssids(dashboard, operations, ORG_ID, NETWORKS + TEMPLATES))

Philip D'Ath
Meraki Community All-Star
Meraki Community All-Star

Have you got a proxy in your organisation or anything doing SSL inspection?

The "self signed" certificate is the suspicous bit. You are talking to something - but it is not Meraki.

Lalana
Cisco Employee
Cisco Employee

Hi Philip,

Thanks for the response. The issue got resolved after adding certificate_path

async with meraki.aio.AsyncDashboardAPI(api_key, maximum_concurrent_requests=1, maximum_retries=4, print_console=True, suppress_logging=False, certificate_path='certificate/path'

It seems that the issue is related to this bug - aiohttp module -https://github.com/aio-libs/aiohttp/issues/955

Thanks & Regards,
Lalana

Philip D'Ath
Meraki Community All-Star
Meraki Community All-Star

Wow. Good find.

Matq
Community Member

Hi @Lalana

I have the same issue so I added as suggested in your post, but here is the error message:

"self._sslcontext.load_verify_locations(certificate_path)

FileNotFoundError: [Errno 2] No such file or directory"

Do you have an idea?

regards,

Lalana
Cisco Employee
Cisco Employee

Hi Matq,

You can add the following to your script:

import certifi

cert_path = certifi.where()
Then add this cert_path while creating AsyncDashboardAPI object:
async with meraki.aio.AsyncDashboardAPI(
api_key,
maximum_concurrent_requests=3,
maximum_retries=10,
print_console=True,
suppress_logging=False,
certificate_path=cert_path, <<<<<< cert_path added here >>>
requests_proxy=https_proxy_server
) as dashboard:

Philip D'Ath
Meraki Community All-Star
Meraki Community All-Star

So demure. So mindful.

I like it!

Thank you Philip

Matq
Community Member

HI,

thanks for your answer and help. Really appreciate it.

I have found the solution.

in application > Python 3.12, i need to execute the program: "install certificates.command"

Then the script will work.

regards,

Mathieu

Lalana
Cisco Employee
Cisco Employee

Thanks Matq for sharing.

Lalana
Cisco Employee
Cisco Employee

Thanks, Would like to Thank Gandhi Racharla and Niraj Gadhe (from Cisco) for helping on this.

Hi! Moderator here. I’m just going to edit your post to remove the email addresses. Appreciate you sharing your words of thanks though!