Files
developer.sailpoint.com/docs/tools/sdk/python/retries.md

1.2 KiB

id, title, pagination_label, sidebar_label, sidebar_position, sidebar_class_name, keywords, description, slug, tags
id title pagination_label sidebar_label sidebar_position sidebar_class_name keywords description slug tags
python-sdk-retries Retries with The Python SDK Retries Retries 7 pythonsdk
py
python
sdk
retry
Learn how to configure retries when using the Python SDK. /tools/sdk/python/retries
SDK

The Python SDK uses the urllib3 retry module to support retry logic.

Here is an example of the retry logic, implemented on line 8. With this configuration, if the returned status code from the API is equal to 502, 503, or 504, the SDK will retry the call up to 5 times:

import sailpoint
import sailpoint.v3
from sailpoint.configuration import Configuration
from sailpoint.paginator import Paginator
import urllib3

configuration = Configuration()
configuration.retries = urllib3.Retry(total=5, status_forcelist=[ 502, 503, 504 ])

api_client = sailpoint.v3.ApiClient(configuration)

accounts = Paginator.paginate(sailpoint.v3.AccountsApi(api_client).list_accounts, result_limit=1000, limit=250)

print(accounts)

Run this command to run the code:

python sdk.py