meraki / dashboard-api-python

Official Dashboard API library (SDK) for Python
MIT License
292 stars 152 forks source link

AsyncDashboardAPI broken in v1.18.0 #178

Closed ollipa closed 2 years ago

ollipa commented 2 years ago

Trying to initialize AsyncDashboardAPI raises RecursionError.

Library version: 1.18.0 Python version: 3.9

Code to reproduce:

from meraki.aio import AsyncDashboardAPI
client = AsyncDashboardAPI("some_token")
# RecursionError: maximum recursion depth exceeded

Stack trace:

---------------------------------------------------------------------------
RecursionError                            Traceback (most recent call last)
Input In [3], in <module>
----> 1 client = AsyncDashboardAPI("some_token")

File /python3.9/site-packages/meraki/aio/__init__.py:146, in AsyncDashboardAPI.__init__(self, api_key, base_url, single_request_timeout, certificate_path, requests_proxy, wait_on_rate_limit, nginx_429_retry_wait_time, action_batch_retry_wait_time, retry_4xx_error, retry_4xx_error_wait_time, maximum_retries, output_log, log_path, log_file_prefix, print_console, suppress_logging, simulate, be_geo_id, caller, use_iterator_for_get_pages, inherit_logging_config, maximum_concurrent_requests)
    143     self._logger = None
    145 # Creates the API session
--> 146 self._session = AsyncRestSession(
    147     logger=self._logger,
    148     api_key=api_key,
    149     base_url=base_url,
    150     single_request_timeout=single_request_timeout,
    151     certificate_path=certificate_path,
    152     requests_proxy=requests_proxy,
    153     wait_on_rate_limit=wait_on_rate_limit,
    154     nginx_429_retry_wait_time=nginx_429_retry_wait_time,
    155     action_batch_retry_wait_time=action_batch_retry_wait_time,
    156     retry_4xx_error=retry_4xx_error,
    157     retry_4xx_error_wait_time=retry_4xx_error_wait_time,
    158     maximum_retries=maximum_retries,
    159     simulate=simulate,
    160     be_geo_id=be_geo_id,
    161     caller=caller,
    162     use_iterator_for_get_pages=use_iterator_for_get_pages,
    163     maximum_concurrent_requests=maximum_concurrent_requests,
    164 )
    166 # API endpoints by section
    167 self.organizations = AsyncOrganizations(self._session)

File /python3.9/site-packages/meraki/aio/rest_session.py:61, in AsyncRestSession.__init__(self, logger, api_key, base_url, single_request_timeout, certificate_path, requests_proxy, wait_on_rate_limit, nginx_429_retry_wait_time, action_batch_retry_wait_time, retry_4xx_error, retry_4xx_error_wait_time, maximum_retries, simulate, be_geo_id, caller, use_iterator_for_get_pages, maximum_concurrent_requests)
     59 self._be_geo_id = be_geo_id
     60 self._caller = caller
---> 61 self.use_iterator_for_get_pages = use_iterator_for_get_pages
     63 # Check base URL
     64 if "v0" in self._base_url:

File /python3.9/site-packages/meraki/aio/rest_session.py:113, in AsyncRestSession.use_iterator_for_get_pages(self, value)
    110 else:
    111     self.get_pages = self._get_pages_legacy
--> 113 self.use_iterator_for_get_pages = value

File /python3.9/site-packages/meraki/aio/rest_session.py:113, in AsyncRestSession.use_iterator_for_get_pages(self, value)
    110 else:
    111     self.get_pages = self._get_pages_legacy
--> 113 self.use_iterator_for_get_pages = value

    [... skipping similar frames: AsyncRestSession.use_iterator_for_get_pages at line 113 (2978 times)]

File /python3.9/site-packages/meraki/aio/rest_session.py:113, in AsyncRestSession.use_iterator_for_get_pages(self, value)
    110 else:
    111     self.get_pages = self._get_pages_legacy
--> 113 self.use_iterator_for_get_pages = value

RecursionError: maximum recursion depth exceeded