Skip to content

Conversation

@fzuerkeraguilar
Copy link

Here are the key changes:

  1. Refactor the __api_request method to replace the hits argument with params (a dictionary), allowing for more flexible API requests. The hits argument was previously used to control the number of hits per page for GET requests, but this was not an ideal solution. The new params argument will allow for more control over GET requests.
  2. Update the way hits are handled in GET requests. Previously, a fixed number of hits per page (1337) was used for all GET requests. Now, if hits is greater than 0, params["per_page"] and params["page"] are set accordingly. If hits is not greater than 0, params['full_result'] is set to 'true', which should return all results.
  3. Update the api_get method to accept the new params argument and pass it to the __api_request method.
  4. Refactor the check_products function to use the new params argument when making GET requests via the api_get method. The params dictionary is used to pass the organization_id to the API.
  5. Add new command-line options -S and --short-ok to control the output display. If -S is used, only the status is output. If --short-ok is used, products are only output if any are not ok.
  6. Update the check_products method to respect the new -S and --short-ok options when displaying output.
  7. Switch to fnmatch based pattern matching in include and exclude to reduce the number of products that have to be listed

Files Changed

  • ForemanAPIClient.py
  • main.py
  • README.md

@fzuerkeraguilar fzuerkeraguilar changed the title Refactor: Improve API request handling and output display Refactor API request handling, add more options for output and use pattern matching for include and exclude Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant