@@ -66,6 +66,7 @@ class AwisApi(object):
66
66
}
67
67
MAX_BATCH_REQUESTS = 5
68
68
MAX_SITES_LINKING_IN_COUNT = 20
69
+ MAX_CATEGORY_LISTINGS_COUNT = 20
69
70
70
71
def __init__ (self , access_id , secret_access_key ):
71
72
self .access_id = access_id
@@ -107,6 +108,24 @@ def request(self, params, tries=3, as_xml=True):
107
108
),
108
109
)
109
110
111
+ def category_listings (self , path , SortBy = "Popularity" , Recursive = False , Start = 1 , Count = MAX_CATEGORY_LISTINGS_COUNT , Descriptions = False ):
112
+ params = { "Action" : "CategoryListings" , "ResponseGroup" : "Listings" }
113
+ params .update ({ "Path" : urllib .quote (path ) })
114
+ params .update ({"SortBy" : SortBy })
115
+ if not Recursive :
116
+ params .update ({"Recursive" : "False" })
117
+ else :
118
+ params .update ({"Recursive" : "True" })
119
+ params .update ({"Start" :str (Start )})
120
+ if Count > self .MAX_CATEGORY_LISTINGS_COUNT :
121
+ raise RuntimeError , "Max number of returned listings is %s." % self .MAX_CATEGORY_LISTINGS_COUNT
122
+ if not Descriptions :
123
+ params .update ({"Descriptions" : "False" })
124
+ else :
125
+ params .update ({"Descriptions" : "True" })
126
+
127
+ return self .request (params )
128
+
110
129
def url_info (self , urls , * response_groups , ** kwargs ):
111
130
params = { "Action" : "UrlInfo" }
112
131
if not isinstance (urls , (list , tuple )):
0 commit comments