Menu

#1 ListLookup not getting multiple pages

open
nobody
None
5
2007-04-14
2007-04-14
Dan Poirier
No

I've been using pyaws for a few days and so far I like it. I'm having a little trouble with ListLookup, though.

I do a query like:

ls = ecs.ListLookup(ListType='WishList',
ListId = 'xxxxxxx',
MerchantId='All',
ResponseGroup = 'Small,ListItems',
Sort = 'Price',
)
And I find:

len(ls) = 1
ls.ListItem is a list of 10 Bags
Each bag has one ListItem - one entry from the wishlist

The problem is the list I'm looking up has 27 items on it, and I'm only getting these 10 of them.

It's also kind of confusing that the length of the result is 1, and ListItem is a list of multiple things... I'm not sure if that's intended.

Thanks for looking into this. Let me know if I can help debug it any further.

Discussion

  • Jason Y-H

    Jason Y-H - 2007-10-17

    Logged In: YES
    user_id=1876508
    Originator: NO

    I see this issue too.

    The 10-item retrieval is logical, since AWS only returns 10 results per page in any query. That is, for a 27 item list, you should get `TotalItems`=27, `TotalPages`=3 and a set of 10 items. Manual calls to using the ProductPage attribute allow you to pull down the items on the other pages. However, adding ProductPage to the ecs.ListLookup call doesn't work--another bug.

    The pagedIterator class in pyAWS is supposed to make pages more or less invisible. Iterating over the results from a call to ListSearch, for instance, will get each list found, in groups of ten -- the pagedIterator takes care of the successive calls for new pages.

    Unfortunately, ListLookup doesn't work like this right now, and I call it a
    bug.

    What happens is basically that the pagedIterator gets applied at one tag too
    high in the DOM hierarchy:

    <Lists> # pagedIterator wraps here
    <List> # when it should wrap here (only one <List> tag in a ListLookup)
    <ListId> # all this stuff gets 'Bag'-ged
    <ListName>
    <TotalItems>
    <TotalPages>
    <ListItem> # this turns into a list of 10 Bags
    <ListItem>
    <ListItem>
    ...
    </List>
    </Lists>

    Thus, you end up with a pagedIterator with one Bag entry (the <List>) that
    can't iterate over the ListItems.

    So I understand the problem now. Don't know how to fix it yet, though.

     
  • Jason Y-H

    Jason Y-H - 2007-10-18

    Logged In: YES
    user_id=1876508
    Originator: NO

    It looks like the problem really lies with the specific way that the response is put together in ListLookup.

    1) The current settings for how to package the response in ecs.ListLookup() explicitly asks for <List> to packaged as Bags inside of <Lists> pagedIterator.

    2) The way length is determined in pagedIterator depends on a <TotalResults> tag which is never present in a lookup. This is logical since there will never be more than one result in a lookup. Instead, there is a <TotalItems> tag *within* the <List> tag.

    So, if you change:

    * ecs.ListLookup plugins['isCollective'] to 'Lists'
    ecs.ListLookup plugins['isCollected'] to 'ListItem'
    the 2nd to last argument from 'Lists' to 'List'

    * the way pagedIterator assigns length to use 'TotalItems' instead of 'TotalResults' during a ListLookup call.

    you can get the iterator to work, and return all the items in the wishlist. However, it seems that all the other information other than the ListItems gets lost.

     
  • Nobody/Anonymous

    Logged In: NO

    Yes, this is a bug.
    The list should be pagetized. Working on it right now.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.