ebay-apiebay-sdk

To get the weight of product in ebay api


Currenly i am working in ebaysdk. I am facing the problem which is the weight of the product. how can i can get product weight ? I used trading api but most of weight of the products equal to 0. is there any way to get every product weight? I requested like this:

response = api_trading.execute('GetItem' , 
{"ItemID":"184097524395",'DestinationPostalCode':'2940','DestinationCountryCode':'GB'})

Solution

  • Some items have their weight included in the "Items Specifics" section, which can only be extracted by setting "IncludeItemSpecifics" to "true" in the trading api execution:

    response = api_trading.execute('GetItem' , {"ItemID":"254350593466", "IncludeItemSpecifics": "true"})
    

    Then, one possible way to get the details of interest is by looping through the dictionary:

    for d in response.dict()['Item']['ItemSpecifics']['NameValueList']: 
        print(d)
    

    The weight Name and Value will be in one of those dictionaries:

    ...
    {'Name': 'Item Length', 'Value': '1', 'Source': 'ItemSpecific'}
    {'Name': 'Item Weight', 'Value': '2.25', 'Source': 'ItemSpecific'}
    {'Name': 'Item Width', 'Value': '1', 'Source': 'ItemSpecific'}
    ...
    

    Source: https://developer.ebay.com/devzone/guides/features-guide/default.html#development/ItemSpecifics.html