Skip to content

Commit

Permalink
orgID should be optional given that it's optional in the API
Browse files Browse the repository at this point in the history
orgID was made a required parameter to address issue #294, however orgID is only required by the API if the user is an administrator. Making orgID required means a script needs to know what org its running under which adds more complexity. IMO making it optional addresses #294 without breaking my code.
  • Loading branch information
starblast authored and bkizer-tenable committed Oct 6, 2021
1 parent 31dff2d commit ce99ee3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tenable/sc/asset_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,15 +440,15 @@ def create(self, name, list_type, **kw):
payload = self._constructor(**kw)
return self._api.post('asset', json=payload).json()['response']

def details(self, id, orgID, fields=None):
def details(self, id, orgID=None, fields=None):
'''
Returns the details for a specific asset-list.
:sc-api:`asset-list: details<Asset.html#AssetRESTReference-/asset/{id}?orgID={orgID}>`
Args:
id (int): The identifier for the asset-list.
orgID (int): The organizationID for the asset-list.
orgID (int, optional): The organizationID for the asset-list.
fields (list, optional): A list of attributes to return.
Returns:
Expand All @@ -461,7 +461,8 @@ def details(self, id, orgID, fields=None):
params = dict()
if fields:
params['fields'] = ','.join([self._check('field', f, str) for f in fields])
params['orgID'] = orgID
if orgID:
params['orgID'] = orgID
return self._api.get('asset/{}'.format(self._check('id', id,int)),params=params).json()['response']

def edit(self, id, **kw):
Expand Down

0 comments on commit ce99ee3

Please sign in to comment.