macadmins / macadmins/jamf-pro-sdk-python
[Feature Request] Add async/await support to SDK
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 69
- Fork
- 16
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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, andAsyncWebhooksClient - 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 usehttpxinstead ofrequests. However,httpxwas built to be a viable replacement forrequests.
Additional Details
This is a follow up to this slack convo. Happy to provide additional details/examples as needed!
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia mappando le classi client e API sincrone esistenti menzionate nella proposta, quindi esamina come cambierebbe l’attuale trasporto basato su requests passando a httpx. Usa l’esempio AsyncJamfProClient come punto di ingresso comportamentale. Il lavoro è completato quando le versioni asincrone dei client elencati supportano la paginazione, la concorrenza e i context manager, mentre il comportamento sincrono esistente rimane invariato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- api, backend
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100