getTransportDetails操作会在获取调度运输(TransportDetail)信息时返回CarrierName字段。以下是使用Python语言中的Boto3 SDK调用getTransportDetails操作以获得CarrierName字段的示例代码:
import boto3
from botocore.config import Config
config = Config(region_name='your_region_name')
access_key = 'your_access_key'
secret_key = 'your_secret_key'
session_token = 'your_session_token'
# Create a session with your credentials
session = boto3.Session(
aws_access_key_id=access_key,
aws_secret_access_key=secret_key,
aws_session_token=session_token,
)
# Create a FulfillmentInbound client
fba_inbound = session.client('fba_inbound', config=config)
# Call getTransportDetails and retrieve the CarrierName field
response = fba_inbound.get_transport_details(
ShipmentId='your_shipment_id', # Replace this with the ID of your shipment
IsPartnered='your_is_partnered_value', # Replace this with a boolean indicating if your shipment is partnered or not
ShipmentType='your_shipment_type' # Replace this with the type of your shipment, either 'SP','LTL','TL'
)
carrier_name = response['TransportDetails']['PartneredLtlData']['CarrierName']
print('Carrier Name:', carrier_name)
此代码示例调用getTransportDetails操作以获取特定货运的运输详细信息,并在响应中检索CarrierName字段值。请确保替换任何示例中的占位符值(如替换your_region_name、your_access_key等)。