我正在尝试使用 python 脚本从有变化的 eBay 商品中读取数量。
清单是: https://www.ebay.co.uk/itm/255827467839 并且有 5 个变体,剩余数量为 3,5,5,0,1
运行以下脚本会返回变体,但数量不正确。
from ebaysdk.trading import Connection
# Replace these with your own credentials
dev_id = 'YOUR_DEV_ID'
app_id = 'YOUR_APP_ID'
cert_id = 'YOUR_CERT_ID'
token = 'YOUR_AUTH_TOKEN'
# Replace this with the item ID you want to retrieve stock for
item_id = 'YOUR_ITEM_ID'
# Create a connection to the eBay Trading API
api = Connection(
domain='api.ebay.com',
config_file=None,
appid=app_id,
devid=dev_id,
certid=cert_id,
token=token,
siteid='0', # Site ID 0 is for the US site
https=True,
)
# Call the GetItem API to retrieve information about the item
response = api.execute('GetItem', {'ItemID': item_id})
# Extract the variations and their quantities from the response
variations = response.reply.Item.Variations.Variation
for variation in variations:
print('Variation:', variation.SKU)
print('Quantity:', variation.Quantity)
返回的结果为:
Variation: 2mm
Quantity: 21
Variation: 3mm
Quantity: 29
Variation: 2.5mm
Quantity: 29
Variation: 1.5mm
Quantity: 20
Variation: 3.5mm
Quantity: 9
这些随机数量是从哪里来的??