confirm API call supports maxResults before checking value

This commit is contained in:
Jay Lee
2019-08-15 10:08:03 -04:00
parent 584ddba1a5
commit a7be6d233b

View File

@@ -1091,7 +1091,10 @@ def getPageSize(service, function, kwargs):
for resource in service._rootDesc.get('resources', {}).values():
for a_method in resource.get('methods', {}).values():
if a_method.get('id') == api_id:
if a_method['parameters'].get('pageSize'):
if not a_method.get('parameters') or a_method['parameters'].get('pageSize') or not a_method['parameters'].get('maxResults'):
# make sure API call supports maxResults. For now we don't care to
# set pageSize since all known pageSize API calls have
# default pageSize == max pageSize
return
return {'maxResults': a_method['parameters']['maxResults'].get('maximum', MAX_RESULTS_API_EXCEPTIONS.get(api_id, None))}