AWS Doc SDK ExamplesWord
기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
a AWS SDK를 사용하여 제안 ID로 계약 검색
다음 코드 예제는 제안 ID별로 계약을 검색하는 방법을 보여줍니다.
- Python
-
- Python용 SDK(Boto3)
-
참고
더 많은 on GitHub가 있습니다. 전체 예제를 찾아 AWS Marketplace API 참조 코드 라이브러리
리포지토리에서 설정 및 실행하는 방법을 알아봅니다. # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """ Purpose Shows how to use the AWS SDK for Python (Boto3) to search for agreements by offer id AG-0 """ import logging import boto3 import utils.helpers as helper from botocore.exceptions import ClientError # offer id to search by offerId = "1111111111111111111111111" MAX_PAGE_RESULTS = 10 logger = logging.getLogger(__name__) def get_agreements(mp_client): AgreementSummaryList = [] partyTypes = ["Proposer"] for value in partyTypes: try: agreement = mp_client.search_agreements( catalog="AWSMarketplace", maxResults=MAX_PAGE_RESULTS, filters=[ {"name": "PartyType", "values": [value]}, {"name": "OfferId", "values": [offerId]}, {"name": "AgreementType", "values": ["PurchaseAgreement"]}, ], ) except ClientError as e: logger.error("Could not complete search_agreements request.") raise AgreementSummaryList.extend(agreement["agreementViewSummaries"]) while "nextToken" in agreement and agreement["nextToken"] is not None: try: agreement = mp_client.search_agreements( catalog="AWSMarketplace", maxResults=MAX_PAGE_RESULTS, nextToken=agreement["nextToken"], filters=[ {"name": "PartyType", "values": [value]}, {"name": "OfferId", "values": [offerId]}, {"name": "AgreementType", "values": ["PurchaseAgreement"]}, ], ) except ClientError as e: logger.error("Could not complete search_agreements request.") raise AgreementSummaryList.extend(agreement["agreementViewSummaries"]) return AgreementSummaryList def usage_demo(): logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") print("-" * 88) print("Looking for an agreement by offer id.") print("-" * 88) mp_client = boto3.client("marketplace-agreement") helper.pretty_print_datetime(get_agreements(mp_client)) if __name__ == "__main__": usage_demo()
-
API 세부 정보는 Word for Python(Boto3) SearchAgreements 참조의 Word를 참조하세요. AWS SDK API
-
종료 날짜별로 계약 검색
제품 ID별로 계약 검색