Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Running python3 async_run.py #1

Closed
fadelnaser opened this issue Dec 6, 2022 · 10 comments
Closed

Error Running python3 async_run.py #1

fadelnaser opened this issue Dec 6, 2022 · 10 comments

Comments

@fadelnaser
Copy link

Ran the following:

python3 async_run.py

Kindly select the organization ID you would like to query: 0
/Users/xxxx/meraki-health-check/async_run.py:1384: DeprecationWarning: There is no current event loop
loop = asyncio.get_event_loop()
Meraki AIO API Error (OrgID "XXXXXX", OrgName "XXXX"):
organizations, getOrganizationAdmins - None None, Reached retry limit: None
Traceback (most recent call last):
File "/Users/xxxx/meraki-health-check/async_run.py", line 1385, in
loop.run_until_complete(main())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
return future.result()
File "/Users/xxxx/meraki-health-check/async_run.py", line 1241, in main
await async_check_org_admins(aiomeraki)
File "/Users/xxxx/meraki-health-check/async_run.py", line 646, in async_check_org_admins
for admin in org_admins:
UnboundLocalError: local variable 'org_admins' referenced before assignment

@obrigg
Copy link
Owner

obrigg commented Dec 6, 2022

Two questions:

  1. Is this a newly generated API key?
  2. Do you have read privileges for the entire organization? Or only selected networks?

@fadelnaser
Copy link
Author

  1. I generated and used for something else but its was generated today
  2. I am full admin

@obrigg
Copy link
Owner

obrigg commented Dec 6, 2022

Interesting.

Can you kindly change lines 1225 & 1226 from:
output_log=False,
suppress_logging=True,

to:
output_log=True,
suppress_logging=False,

This should give us more insight into what's happening.

@fadelnaser
Copy link
Author

zations/669347494617942640/admins - 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
2022-12-06 17:38:53 meraki.aio: INFO > GET https://api.meraki.com/api/v1/organizations/669347494617942640/admins
2022-12-06 17:38:53 meraki.aio: WARNING > organizations, getOrganizationAdmins > https://api.meraki.com/api/v1/organizations/669347494617942640/admins - 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
^CTraceback (most recent call last):
File "/Users/forterm1_test/meraki-health-check/async_run.py", line 1385, in
loop.run_until_complete(main())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 633, in run_until_complete
self.run_forever()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 600, in run_forever
self._run_once()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 1860, in _run_once
event_list = self._selector.select(timeout)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/selectors.py", line 562, in select
kev_list = self._selector.control(None, max_ev, timeout)

@obrigg
Copy link
Owner

obrigg commented Dec 6, 2022

Self-signed certificate in certificate chain?
Is there a proxy trying to intervene with the communication?

@fadelnaser
Copy link
Author

nope there shouldn't be anything tryint to intervene. This is on my LAN and trying to communicate to the meraki.

@bbaileyga1
Copy link

having similar issue when running on 1st organization script completes without issues. When running on 2nd organization (much larger device count)
I get the following output with logging turned on:

2023-08-16 18:40:10 meraki.aio: INFO > Meraki dashboard API session initialized with these parameters: {'version': '1.36.0', 'api_key': '************************************498e', 'base_url': 'https://api.meraki.com/api/v1', 'single_request_timeout': 60, 'certificate_path': '', 'requests_proxy': '', 'wait_on_rate_limit': True, 'nginx_429_retry_wait_time': 2, 'action_batch_retry_wait_time': 60, 'network_delete_retry_wait_time': 180, 'retry_4xx_error': False, 'retry_4xx_error_wait_time': 60, 'maximum_retries': 100, 'simulate': False, 'be_geo_id': None, 'caller': 'Healthcheck/22.12 OBrigg', 'use_iterator_for_get_pages': False, 'maximum_concurrent_requests': 5, 'version_warning_string': 'This library requires Python 3.7 at minimum. Python versions 3.6 and below are end of life and end of support per the Python maintainers, and your interpreter version details are: \nplatform.python_version_tuple()[0] = 3\nplatform.python_version_tuple()[1] = 11\nplatform.python_version is 3.11.4\nPlease consult the readme at your convenience: https://github.com/meraki/dashboard-api-python'}
2023-08-16 18:40:11 meraki.aio: INFO > GET https://api.meraki.com/api/v1/organizations/613052499275809599/admins
2023-08-16 18:40:11 meraki.aio: INFO > organizations, getOrganizationAdmins > https://api.meraki.com/api/v1/organizations/613052499275809599/admins - 200 OK
Admin Arthur Sellers (email: XXXX@XXXXXXX.com) has 2FA enabled
Admin RSM Network Solution Set (email: XXXX@XXXXX.com) has 2FA enabled
More than one admin has full rights. This is recommended.
2023-08-16 18:40:11 meraki.aio: INFO > GET https://api.meraki.com/api/v1/organizations/613052499275809599/apiRequests
2023-08-16 18:40:11 meraki.aio: INFO > GET https://api.meraki.com/api/v1/organizations/613052499275809599/apiRequests
2023-08-16 18:40:12 meraki.aio: INFO > organizations, getOrganizationApiRequests; page 1 > https://api.meraki.com/api/v1/organizations/613052499275809599/apiRequests - 200 OK
2023-08-16 18:40:12 meraki.aio: INFO > organizations, getOrganizationApiRequests; page 1 > https://api.meraki.com/api/v1/organizations/613052499275809599/apiRequests - 200 OK
Some other ERROR: 'URL' object has no attribute 'decode'
Traceback (most recent call last):
File "/home/baileb/meraki-health-check/meraki-health-check/async_run.py", line 1386, in
loop.run_until_complete(main())
File "/usr/lib64/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/baileb/meraki-health-check/meraki-health-check/async_run.py", line 1259, in main
await async_check_org_admins(aiomeraki)
File "/home/baileb/meraki-health-check/meraki-health-check/async_run.py", line 683, in async_check_org_admins
await task
File "/usr/lib64/python3.11/asyncio/tasks.py", line 605, in _wait_for_one
return f.result() # May raise f.exception().
^^^^^^^^^^
File "/home/baileb/meraki-health-check/meraki-health-check/async_run.py", line 706, in async_check_api_calls
for request in api_requests:
^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'api_requests' where it is not associated with a value

any insight would be appreciated

@obrigg
Copy link
Owner

obrigg commented Aug 17, 2023

Hi @bbaileyga1 ,
This actually looks like a different problem. One of the getOrganizationApiRequests API calls fails for some reason.
'URL' object has no attribute 'decode'

If the issue consists, kindly open a new issue.

@obrigg
Copy link
Owner

obrigg commented Sep 12, 2023

Someone else encountered this "self-signed certificate" problem, and it looks like it might be a problem with the Meraki SDK.
I created this issue to troubleshoot it.

@obrigg
Copy link
Owner

obrigg commented Oct 17, 2023

The engineering team is not able to reproduce this error.
Disabling certificate validation is a workaround, but it's not a best practice in terms of security.

@obrigg obrigg closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants