GetTargetId
get_target_id(public_api_client, target_name)
Expand source code
get_target_id(public_api_client, target_name):"""Description-----------To get the target id of a given chipset.Args----public_api_client: QDC api client object.target_name: Name of the chipset.Returns-------int: ID of the given chipset.None: In case of failure.Usages------target = "SC8280XP"target_id = qdc_api.get_target_id(public_api_client, target)"""target_id = None# Get list of targetstargets_response = targets_get.sync_detailed(client=get_client_with_headers_added(public_api_client), page_size=200)if targets_response.status_code == 200:print(f"Target list: Received {len(targets_response.parsed.data)} of {targets_response.parsed.total} targets (page {targets_response.parsed.page_number})")for target in targets_response.parsed.data:print(f'TargetId: {target.target_id}, ChipsetName: {target.chipset_name}, ChipsetMarketingName: {target.chipset_marketing_name}, 'f'ChipsetPlatform {target.chipset_platform_name}, ChipsetCategory: {target.chipset_category}, OS: {target.os}, 'f'OSVersion: {target.os_version}, State: {target.state}')if target.chipset_name == target_name:target_id = target.target_idelse:print(f"Get list of targets failed with error code {targets_response.status_code} {targets_response.content.decode('utf-8')}")if target_id is not None:print(f"Target id for {target_name} is {target_id}")return target_idelse:print(f"Cannot find target for {target_name}, exit.")return None
Description
To get the target id of a given chipset.
Arguments
public_api_client
: QDC api client object.target_name
: Name of the chipset.
Returns
int
: ID of the given chipset.None
: In case of failure.
Usages
target = "SC8280XP"target_id = qdc_api.get_target_id(public_api_client, target)