-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support async request sdk #81
Comments
@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 |
|
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?
The text was updated successfully, but these errors were encountered: