【问题标题】:How to use python ebaysdk to filter items from a multi variation listing (listing of more than one item)如何使用 python ebaysdk 从多变体列表中过滤项目(多个项目的列表)
【发布时间】:2020-04-17 17:54:29
【问题描述】:

当我使用 python find sdk 通过 eBay 搜索列表时,我通常会得到包含两个或多个我没有搜索的项目的列表的结果。一个例子:

request1 = {
        'keywords': "Iphone x 64gb", # I am searching for Listings of an iPhone x 64gb
        'itemFilter': [
            {'name': 'Condition', 'value': 'Used'},
            {'name': 'currency', 'value': 'CAD'},
            {'name': 'minPrice', 'value': 100.0}
        ],
        'paginationInput': {
            'entriesPerPage': 100,
            'pageNumber': 13
        },
        'sortOrder': 'BestMatch'
}

 api = find_connect(config_file='ebay.yml',  siteid="EBAY-ENCA")
 resp = api.execute('FindPopularItems', request1).dict() # Change from XML to dictionary
 parse_response(reps) # send the dictionary of listings to be parsed

当我查看一些从 API 请求返回的列表时,我可以得到类似的东西

itemId: 303279232871
title: Apple iPhone X Smartphone 64GB 256GB AT&T Sprint T-Mobile Verizon or Unlocked
globalId: EBAY-US
subtitle: 30-Day Warranty - Free Charger & Cable - Easy Returns!
primaryCategory: {'categoryId': '9355', 'categoryName': 'Cell Phones & Smartphones'}
galleryURL: https://thumbs4.ebaystatic.com/pict/303279232871404000000001_2.jpg
viewItemURL: https://www.ebay.ca/itm/Apple-iPhone-X-Smartphone-64GB-256GB-AT-T-Sprint-T-Mobile-Verizon-Unlocked-/303279232871?var=602277420740
paymentMethod: PayPal
autoPay: true
postalCode: 660**
location: USA
country: US
shippingInfo: {'shippingServiceCost': {'_currencyId': 'CAD', 'value': '23.83'}, 'shippingType': 'Flat', 'shipToLocations': 'Worldwide'}
sellingStatus: {'currentPrice': {'_currencyId': 'USD', 'value': '309.0'}, 'convertedCurrentPrice': {'_currencyId': 'CAD', 'value': '436.46'}, 'sellingState': 'Active', 'timeLeft': 'P21DT20H28M35S'}
listingInfo: {'bestOfferEnabled': 'false', 'buyItNowAvailable': 'false', 'startTime': '2019-09-09T14:07:31.000Z', 'endTime': '2020-05-09T14:07:31.000Z', 'listingType': 'FixedPrice', 'gift': 'false', 'watchCount': '18'}
galleryPlusPictureURL: https://galleryplus.ebayimg.com/ws/web/303279232871_1_3459_1_00000001.jpg
condition: {'conditionId': '2500', 'conditionDisplayName': 'Seller refurbished'}
isMultiVariationListing: true # **This means that it is a multi variation listing**
topRatedListing: false

这是 Iphone x 64gb 和 256gb 价格不同的列表。甚至可能有超过 2 件不同价格的商品(客户可能想要,但它是二手的或新的,等等)。但是,我不只是想从我的数据集中丢弃它,因为 eBay 的 API 最多只返回 10000 个列表,并且每天只允许 5000 次调用(数据仍然相关)。 如何从列表中过滤每个单独的项目?

【问题讨论】:

    标签: python ebay-api ebay-sdk


    【解决方案1】:

    我能想到的应该有帮助的一件事是,如果您按方面而不是使用关键字进行查询。下面的示例查找具有“64 GB”存储空间的“iphone x”结果。方面过滤必须在适当的类别内完成。这也假设卖家已经使用结构化数据创建了列表。

    api_request = {
        'keywords': "Iphone x", 
        'itemFilter': [
            {'name': 'Condition', 'value': 'Used'},
            {'name': 'currency', 'value': 'CAD'},
            {'name': 'minPrice', 'value': 100.0}
        ],
        'aspectFilter': [
            {
                'aspectName': 'Storage Capacity',
                'aspectValueName': '16 GB',
            }
        ],
        'categoryId': 9355,
        'outputSelector': [
            'AspectHistogram',
        ],
        'paginationInput': {
            'entriesPerPage': 100,
            'pageNumber': 1
        },
        'sortOrder': 'BestMatch'
    }
    

    【讨论】:

    • 此解决方案不会删除所有多变体列表吗?通常,多变体列表是由信誉良好的卖家制作的,这意味着我会遗漏相关数据。有没有办法从多变量中提取每个项目的数据?
    • 我认为 API 存在问题,因为 aspectFilter 只会让事情变得更糟。当我使用 aspectFilter 运行代码时,我不仅仍然得到多变量列表,我得到的只是“iPhone 6”项目列表而不是“iPhone x”
    猜你喜欢
    • 2015-06-04
    • 1970-01-01
    • 2017-08-20
    • 2021-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多