meraki / dashboard-api-python

Official Dashboard API library (SDK) for Python
MIT License
287 stars 149 forks source link

aiomeraki.organizations.getOrganizationApiRequests failing after upgrading the SDK from 1.34.0 to 1.36.0 #222

Closed obrigg closed 11 months ago

obrigg commented 1 year ago

Describe how you confirmed the issue is with the library, and not with the API itself, or a server-side issue of some other kind. Same script works fine with SDK 1.34.0, but fails on 1.36.0.

Python version installed Python 3.10.8

Meraki library version installed 1.34.0 and 1.36.0

Have you reproduced the issue with the latest version of this library? And with the latest version of Python?

OS Platform MacOS Ventura 13.5

Describe the bug After upgrading one of the virtual environments to the Python SDK 1.36.0, one of my scripts started failing with the operation aiomeraki.organizations.getOrganizationApiRequests ('URL' object has no attribute 'decode'). The operation works fine in sync mode and works fine when downgrading to version 1.34.0.

How can we replicate the problem you're reporting? Try running the aiomeraki.organizations.getOrganizationApiRequests operation at versions 1.34.0 and 1.36.0.

bbaileyga1 commented 1 year ago

Thanks, I find it curious that it worked fine with one org with 1 network but the second org with 10 networks it failed.

obrigg commented 1 year ago

Good question. I'm not sure yet. I think it depends on the amount of API activity in the organization.

TKIPisalegacycipher commented 11 months ago

On my end the command completes successfully, so I'm not able to reproduce this in 1.36.0.

Please provide an example script where this is reproducible.

obrigg commented 11 months ago

Sure. Just tried it with 1.37 - still occurs. The API key and org are the DevNet sandbox, that's why they're visible.

import asyncio
import meraki.aio

async def main():
    async with meraki.aio.AsyncDashboardAPI(
        api_key="75dd5334bef4d2bc96f26138c163c0a3fa0b5ca6",
        output_log=False,
        suppress_logging=True,
        maximum_concurrent_requests=5,
        nginx_429_retry_wait_time=2,
        wait_on_rate_limit=True,
        maximum_retries=100,
    ) as aiomeraki:
        try:
            api_requests = await aiomeraki.organizations.getOrganizationApiRequests(org_id, timespan=7 * 86400, perPage=1000, total_pages=10)
        except Exception as e:
            print(f"Some other ERROR: {e}")

org_id = 1215707
loop = asyncio.new_event_loop()
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
TKIPisalegacycipher commented 9 months ago

If you encounter this issue, please ensure you update to the latest version of the repo, at least 1.39.0.