You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from dnacentersdk import DNACenterAPI
from requests import session
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
if __name__ == '__main__':
retries = Retry(
total=20,
backoff_factor=0.1,
status_forcelist=(400, 429, 500, 502, 503, 504),
)
http = session()
http.mount('https://', HTTPAdapter(max_retries=retries))
api = DNACenterAPI(
base_url='https://dnac.mydomain.com',
username=USERNAME,
password=PASSWORD,
session=http,
)
print(api.devices.get_device_list())
We need to be able to inject our own requests.Session object in order to tweak behavior, such as above. Right now, we're monkey-patching the Session object. It would be nice to support injection as a native feature.
I have staged you a pull request for tested code which supports this injection pattern; the snippet above works with the code included in #148
The text was updated successfully, but these errors were encountered:
I'm going to close this issue, in the new version this is the change of the PR.
Any problems that arise feel free to open a new issue or reopen this one.
Best regards.
We need to be able to inject our own requests.Session object in order to tweak behavior, such as above. Right now, we're monkey-patching the Session object. It would be nice to support injection as a native feature.
I have staged you a pull request for tested code which supports this injection pattern; the snippet above works with the code included in #148
The text was updated successfully, but these errors were encountered: