Skip to content

Commit

Permalink
Added page_size parameter, defaulting it to 100.
Browse files Browse the repository at this point in the history
  • Loading branch information
lbajada committed Jun 5, 2024
1 parent fba09f3 commit d211a07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ As there is no API to create or update Portal Documentation on Apigee, this scri

**refresh_token** - Same as in **upload_spec.py**.

**page_size** - The amount of elements to return for API calls that have paging. Default is 100.

## upload_theme.py

This python script leverages Apigee internal APIs to maintain an apigee portal look and feel, by modifiying logos, stylesheets etc. This script uses a custom configuration file described below, to reference different theme resoures.
Expand Down
8 changes: 6 additions & 2 deletions automation/upload_portal_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def documentation_exists(
there is an existing one using the given spec name."""

response = REQUEST.get(
'https://apigee.com/portals/api/sites/{}/apidocs?pageSize={}}'.format(portal_name, page_size))
'https://apigee.com/portals/api/sites/{}/apidocs?pageSize={}'.format(portal_name, page_size))

if response.status_code != 200:
raise RestException(utils.print_error(response))
Expand Down Expand Up @@ -157,6 +157,10 @@ def parse_args():
'-rt',
'--refresh_token',
help='apigee refresh token')
req_grp.add_argument(
'-pgs',
'--page_size',
help='page size for API calls that use paging - default is 100')

parsed = parser.parse_args()

Expand All @@ -178,7 +182,7 @@ def main():
password = args.password
refresh_token = args.refresh_token

# Some API calls make use of paging, if the page size is not defined, we default it to 100
# Some API calls make use of paging, if the page size is not defined, we default it to 100.
page_size = 100 if args.page_size is None else args.page_size

data = open(doc_path, 'r', encoding='utf8').read()
Expand Down

0 comments on commit d211a07

Please sign in to comment.