Skip to content

[Feature Request] Add async/await support to SDK #73

@liquidz00

Description

@liquidz00

Proposal

Add native asynchronous (async/await) support to the Jamf Pro SDK, enabling use with modern async Python frameworks.

Features:

  • Async client classes: AsyncJamfProClient, AsyncProApi, AsyncClassicApi, AsyncJCDS2, and AsyncWebhooksClient
  • Async pagination & concurrency operations
  • Context manager support

Backwards compatibility is ensured as we would not be modifying existing synchronous code whatsoever.

Implementation Example

import asyncio
from jamf_pro_sdk import AsyncJamfProClient, ApiClientCredentialsProvider

async def main():
    async with AsyncJamfProClient(
        server="jamf.my.org",
        credentials=ApiClientCredentialsProvider("client_id", "client_secret")
    ) as client:
        # Single async operation
        computers = await client.classic_api.list_all_computers()
        
        # Concurrent operations
        computer_ids = [c.id for c in computers]
        async for computer in client.async_concurrent_api_requests(
            handler=client.classic_api.get_computer_by_id,
            arguments=computer_ids
        ):
            print(f"{computer.general.name}")

asyncio.run(main())

Note

To support both sync and async operations, the SDK would use httpx instead of requests. However, httpx was built to be a viable replacement for requests.

Additional Details

This is a follow up to this slack convo. Happy to provide additional details/examples as needed!

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions