Open wangxin688 opened 1 year ago
@wangxin688 I'm assigning this to @zapodeanu as the Cisco lead.
@wangxin688 This is an interesting ask. We need to investigate this, to see the implications on the Cisco DNA Center Platform.
@zapodeanu if you're open to auto-generating the Python SDK, you can get async out-of-the-box. www.buildwithfern.com
@wangxin688 This is an interesting ask. We need to investigate this, to see the implications on the Cisco DNA Center Platform. @wangxin688 At this time there is no support for httpx or aiohttp clients. I am not sure how many workflow automations would have a real performance improvement from them.
@wangxin688 This is an interesting ask. We need to investigate this, to see the implications on the Cisco DNA Center Platform. @wangxin688 At this time there is no support for httpx or aiohttp clients. I am not sure how many workflow automations would have a real performance improvement from them.
thanks. hope to receive your feedback asap
why cant you use a thread pool executor? it is safe to use with the requests pkg
import concurrent.futures
from typing import List, Mapping
from dnacentersdk import api
client = api.DNACenterAPI(
username="username",
password="password",
base_url="url",
version="2.3.3.0",
verify=False,
single_request_timeout=60,
)
with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
device_uuids = ["wefwewefwef", "efw", "fwefwwefweefw", "fwefwefwefwfwef"]
futures = []
results: List[Mapping] = list()
for uuid in device_uuids:
futures.append(
executor.submit(
client.devices.get_device_by_id,
id=uuid,
)
)
for future in concurrent.futures.as_completed(futures):
results.append(future.result())
now python sdk is only support sync way, is there any plan to add async with httpx or aiohttp client? or I don't not if you will aceept PR/MR for community?