Skip to content

Commit

Permalink
Looks like no count == 100 for category listings
Browse files Browse the repository at this point in the history
Weird.
  • Loading branch information
Allen Luce committed Jan 26, 2016
1 parent 2130fc3 commit d34dafe
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions awis/__init__.py
Expand Up @@ -74,7 +74,7 @@ class AwisApi(object):
}
MAX_BATCH_REQUESTS = 5
MAX_SITES_LINKING_IN_COUNT = 20
MAX_CATEGORY_LISTINGS_COUNT = 100
MAX_CATEGORY_LISTINGS_COUNT = 20

def __init__(self, access_id, secret_access_key):
self.access_id = access_id
Expand Down Expand Up @@ -116,19 +116,20 @@ def request(self, params, tries=3, as_xml=True):
),
)

def category_listings(self, path, SortBy="Popularity", Recursive=False, Start=1, Count=MAX_CATEGORY_LISTINGS_COUNT, Descriptions=False):
if Count > self.MAX_CATEGORY_LISTINGS_COUNT:
raise RuntimeError("Max number of returned listings is %s." % self.MAX_CATEGORY_LISTINGS_COUNT)
def category_listings(self, path, SortBy="Popularity", Recursive=False, Start=1, Count=100, Descriptions=False):
if Count > self.MAX_CATEGORY_LISTINGS_COUNT and Count != 100:
raise RuntimeError("Max number of specified returned listings is %s." % self.MAX_CATEGORY_LISTINGS_COUNT)
params = {
"Action": "CategoryListings",
"ResponseGroup": "Listings",
"Path": quote(path),
"SortBy": SortBy,
"Count": str(Count),
"Start": str(Start),
"Recursive": str(Recursive),
"Descriptions": str(Descriptions)
}
if Count < 100:
params.update({"Count": str(Count)})

return self.request(params)

Expand Down

0 comments on commit d34dafe

Please sign in to comment.