PyCharm 2024.1 - Python SDK Error

Running PyCharm 2024.1 and the sdk.py that came with the Python SDK for SailPoint (slight modification for limit amount and added a counter).

Script is posted below:

Trying to figure out why I am getting the following errors:
Traceback (most recent call last):
** File “C:\PycharmProjects\SailPoint_New\sdk.py”, line 57, in **
** accounts = Paginator.paginate(sailpoint.v3.AccountsApi(api_client).list_accounts, 1000, limit=100)**
** File “C:\PycharmProjects\Interpreter\lib\site-packages\sailpoint\paginator.py”, line 33, in paginate**
** results = T(kwargs)
** File “C:\PycharmProjects\Interpreter\lib\site-packages\pydantic\validate_call_decorator.py”, line 59, in wrapper_function**
** return validate_call_wrapper(args, kwargs)
** File “C:\PycharmProjects\Interpreter\lib\site-packages\pydantic_internal_validate_call.py”, line 81, in call
*
** res = self.pydantic_validator.validate_python(pydantic_core.ArgsKwargs(args, kwargs))**
** File “C:\PycharmProjects\Interpreter\lib\site-packages\sailpoint\v3\api\accounts_api.py”, line 1920, in list_accounts**
** return self.api_client.response_deserialize(**
** File “C:\PycharmProjects\Interpreter\lib\site-packages\sailpoint\v3\api_client.py”, line 316, in response_deserialize**
** return_data = self.deserialize(response_text, response_type)**
** File “C:\PycharmProjects\Interpreter\lib\site-packages\sailpoint\v3\api_client.py”, line 392, in deserialize**
** return self.__deserialize(data, response_type)**
** File “C:\PycharmProjects\Interpreter\lib\site-packages\sailpoint\v3\api_client.py”, line 408, in __deserialize**
** return [self.__deserialize(sub_data, sub_kls)**
** File “C:\PycharmProjects\Interpreter\lib\site-packages\sailpoint\v3\api_client.py”, line 408, in **
** return [self.__deserialize(sub_data, sub_kls)**
** File “C:\PycharmProjects\Interpreter\lib\site-packages\sailpoint\v3\api_client.py”, line 431, in __deserialize**
** return self.__deserialize_model(data, klass)**
** File “C:\PycharmProjects\Interpreter\lib\site-packages\sailpoint\v3\api_client.py”, line 733, in __deserialize_model**
** return klass.from_dict(data)**
** File “C:\PycharmProjects\Interpreter\lib\site-packages\sailpoint\v3\models\account.py”, line 132, in from_dict**
** _obj = cls.model_validate({**
** File “C:\PycharmProjects\Interpreter\lib\site-packages\pydantic\main.py”, line 532, in model_validate**
** return cls.pydantic_validator.validate_python(**
pydantic_core._pydantic_core.ValidationError: 1 validation error for Account
attributes
** Input should be a valid dictionary [type=dict_type, input_value=None, input_type=NoneType]**
** For further information visit Redirecting...**

import sailpoint
import sailpoint.v3
import sailpoint.beta
from sailpoint.configuration import Configuration
from sailpoint.paginator import Paginator
from sailpoint.v3.models.search import Search
from pprint import pprint

configuration = Configuration()
    
# Enter a context with an instance of the API client
with sailpoint.v3.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = sailpoint.v3.TransformsApi(api_client)

    # List transforms
    try:
        # List transforms
        api_response = api_instance.list_transforms()
        print("The response of TransformsApi->list_transforms:\n")
        for transform in api_response:
            pprint(transform.name)
    except Exception as e:
        print("Exception when calling TransformsApi->list_transforms: %s\n" % e)

    # List Access Profiles
    api_instance = sailpoint.v3.AccessProfilesApi(api_client)

    try:
        api_response = api_instance.list_access_profiles()
        print("The response of AccessProfilesApi->list_access_profiles:\n")
        for access_profile in api_response:
            pprint(access_profile.name)
    except Exception as e:
        print(
            "Exception when calling AccessProfilesApi->list_access_profiles: %s\n" % e
        )
    
    # Use the paginator with search

    search = Search()
    search.indices = ['identities']
    search.query = {'query': '*'}
    search.sort = ['-name']
    identityCount = 0
    accountCount = 0

    identities = Paginator.paginate_search(sailpoint.v3.SearchApi(api_client), search, 250, 1500)
    for identity in identities:
        print(identity['name'])
        identityCount = identityCount + 1

    print("Total Identities: " + str(identityCount))

    # Use the paginator to paginate 1000 accounts 100 at a time
    accounts = Paginator.paginate(sailpoint.v3.AccountsApi(api_client).list_accounts, 1000, limit=100)
    print(len(accounts))
    for account in accounts:
        print(account.name)
        accountCount = accountCount + 1

    print("Total Accounts: " + str(accountCount))

with sailpoint.beta.ApiClient(configuration) as api_client:

    workgroups = sailpoint.beta.GovernanceGroupsApi(api_client).list_workgroups()
    for workgroup in workgroups:
        print(workgroup.name)

Hey @ScottTanselle,

I am working on a fix for this now, today we don’t account for when an Account has an attributes object that is null.

I’ve updated our api specifications and we will have a new python SDK build out shortly that includes these fixes.

I will post back here when it is available. Hang tight!

Hey Tyler,

Thank you for the update. Just starting to learn Python with Sailpoint so it not a major rush

1 Like

@tyler_mairose I wasn’t sure if I should start a new thread on this topic, but I have a similar error with the validation for source “features” when attempting list_sources.

We utilize CIEM and the connector feature for this connector is “USES_UUID”, which is not a valid enum.

1 Like

@Aus10GatPNB Thank you!

I see that missing from the spec as well. I will include this in the release as well!

1 Like

Tyler,

As you can see from the output, using the default sdk.py file that is included in the Python SDK, there is a typo. Recieved should be Received

Paginating call, offset = 197500
Recieved 250 results
Paginating call, offset = 197750
Recieved 250 results

Thanks @ScottTanselle and @Aus10GatPNB,

Here is the latest release that addresses all the items you’ve sent! Thank you for bringing these to our attention and if you find anything else don’t hesitate to put in an issue on the repo!

1 Like

Thank you for the quick response and update to the SDK.

I have verified that the 2 issues I noticed have been resolved.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.