<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Meraki SDK rate limiting in Network Platform API</title>
    <link>https://community.cisco.com/t5/network-platform-api/meraki-sdk-rate-limiting/m-p/5452475#M8108</link>
    <description>&lt;P&gt;I think I'm the only one calling the API, as the api key wasn't turned on in the dashboard until I turned it on.  I've been using the SDK, instead of calling the API directly.  I think I'll refactor to use requests and call the API directly.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Nov 2023 13:24:26 GMT</pubDate>
    <dc:creator>cscbrannent</dc:creator>
    <dc:date>2023-11-09T13:24:26Z</dc:date>
    <item>
      <title>Meraki SDK rate limiting</title>
      <link>https://community.cisco.com/t5/network-platform-api/meraki-sdk-rate-limiting/m-p/5452471#M8104</link>
      <description>&lt;P&gt;Hello - I've written a python script using the Meraki SDK to retrieve subnets from our org, about 600 networks, about 3 vlans/subnets per network.   I'd like to compile a list and sort/organize all the subnets. &lt;BR /&gt;&lt;BR /&gt;The script works fine if I limit it to the first 10.  If I "unleash it", it crashes after about 30 networks.  Error messages are coming from inside the SDK - it appears to be rate limiting.&lt;/P&gt;&lt;P&gt;Google fu suggested using "&lt;STRONG&gt;ratelimit&lt;/STRONG&gt;" package - &lt;A title="ratelimit" href="http:// https://pypi.org/project/ratelimit/" target="_self" rel="nofollow noopener noreferrer"&gt;ratelimit&lt;/A&gt; with a decorator around functions making calls.  &lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;@limits(calls=10, period=1)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;However, this hasn't helped.  Googling and watching cisco/meraki videos is talking about making API calls, and that the SDK magically takes care of ratel imiting.  I'm looking for the actual reference, in the SDK documentation, to how to configure rate limiting, how to check on it, troubleshoot, etc.&lt;BR /&gt;&lt;BR /&gt;My function call, that appears to be over running the ratelimit.&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;@limits(calls=10, period=1)
def get_vlans(client, network_id): 
    """Get the subnets of the network(branch).  The branch will have multiple subnets
    Return format: [{"name":vlanA, "subnet":"1.2.3.4/24"}, {"name":"vlanB", "subnet":"1.2.3.4/24"} ]"""
    vlans_controller = client.vlans
    results = vlans_controller.get_network_vlans(network_id)

    subnets = []
    
    for item in results:
        a_subnet = {} # 
        a_subnet['name'] = item['name']
        a_subnet['subnet'] = item['subnet']
        subnets.append(a_subnet) # Adding an invididual vlan dictionary to the list of subnets.
    
    mx_vlans = subnets
    return mx_vlans&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 19:28:25 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/meraki-sdk-rate-limiting/m-p/5452471#M8104</guid>
      <dc:creator>cscbrannent</dc:creator>
      <dc:date>2023-11-08T19:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Meraki SDK rate limiting</title>
      <link>https://community.cisco.com/t5/network-platform-api/meraki-sdk-rate-limiting/m-p/5452472#M8105</link>
      <description>&lt;P&gt;Crash messages:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample language-python"&gt;&lt;CODE&gt;  File "c:\Users\brannen.taylor\Code\meraki\meraki_env\Lib\site-packages\meraki_sdk\controllers\vlans_controller.py", line 60, in get_network_vlans
    self.validate_response(_context)
  File "c:\Users\brannen.taylor\Code\meraki\meraki_env\Lib\site-packages\meraki_sdk\controllers\base_controller.py", line 94, in validate_response
    raise APIException('HTTP response not OK.', context)
meraki_sdk.exceptions.api_exception.APIException: HTTP response not OK.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Nov 2023 19:30:02 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/meraki-sdk-rate-limiting/m-p/5452472#M8105</guid>
      <dc:creator>cscbrannent</dc:creator>
      <dc:date>2023-11-08T19:30:02Z</dc:date>
    </item>
    <item>
      <title>Re: Meraki SDK rate limiting</title>
      <link>https://community.cisco.com/t5/network-platform-api/meraki-sdk-rate-limiting/m-p/5452473#M8106</link>
      <description>&lt;P&gt;Pretty sure you are hitting the API rate limit of 10 CPS. &lt;/P&gt;&lt;P&gt;Can you print the HTTP code ? It should be 429. &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The logic is : if you get a 429 , wait ...  if you get a 429 again , wait a bit longer... &lt;/P&gt;&lt;P&gt;Are you the only one using API on your Org ?&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 19:47:47 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/meraki-sdk-rate-limiting/m-p/5452473#M8106</guid>
      <dc:creator>Raphael_L</dc:creator>
      <dc:date>2023-11-08T19:47:47Z</dc:date>
    </item>
    <item>
      <title>Re: Meraki SDK rate limiting</title>
      <link>https://community.cisco.com/t5/network-platform-api/meraki-sdk-rate-limiting/m-p/5452474#M8107</link>
      <description>&lt;P&gt;Specify maximum_concurrent_requests and set it to something like 5.  Here is an example (this is using async io, but you get the idea).&lt;/P&gt;&lt;PRE class="lia-code-sample language-markup"&gt;&lt;CODE&gt;	async with meraki.aio.AsyncDashboardAPI(
		output_log=False,
		print_console=False,		
#		maximum_retries=100,
		maximum_concurrent_requests=5
	) as dashboard:&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Nov 2023 20:09:21 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/meraki-sdk-rate-limiting/m-p/5452474#M8107</guid>
      <dc:creator>Philip D'Ath</dc:creator>
      <dc:date>2023-11-08T20:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: Meraki SDK rate limiting</title>
      <link>https://community.cisco.com/t5/network-platform-api/meraki-sdk-rate-limiting/m-p/5452475#M8108</link>
      <description>&lt;P&gt;I think I'm the only one calling the API, as the api key wasn't turned on in the dashboard until I turned it on.  I've been using the SDK, instead of calling the API directly.  I think I'll refactor to use requests and call the API directly.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2023 13:24:26 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/meraki-sdk-rate-limiting/m-p/5452475#M8108</guid>
      <dc:creator>cscbrannent</dc:creator>
      <dc:date>2023-11-09T13:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: Meraki SDK rate limiting</title>
      <link>https://community.cisco.com/t5/network-platform-api/meraki-sdk-rate-limiting/m-p/5452476#M8109</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;SPAN&gt;using the Meraki SDK&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi &lt;A href="https://community.meraki.com/t5/user/viewprofilepage/user-id/2034"&gt;@cscbrannent&lt;/A&gt; would you be able to link to the SDK that you are using? Based on your code, it looks like you might be using an obsolete SDK. It doesn't look like you're using the current Python library, which &lt;EM&gt;does &lt;/EM&gt;handle rate limiting for you.&lt;/P&gt;&lt;P&gt;Also, check out &lt;A title="this example local subnet dumper script" href="https://github.com/meraki/dashboard-api-python/blob/main/examples/local_subnet_dumper.py" target="_blank" rel="noopener nofollow noreferrer"&gt;this example local subnet dumper script&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2023 01:56:31 GMT</pubDate>
      <guid>https://community.cisco.com/t5/network-platform-api/meraki-sdk-rate-limiting/m-p/5452476#M8109</guid>
      <dc:creator>John-on-API</dc:creator>
      <dc:date>2023-11-14T01:56:31Z</dc:date>
    </item>
  </channel>
</rss>

