Refactor API request handling, add more options for output and use pattern matching for include and exclude #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here are the key changes:
__api_requestmethod to replace thehitsargument withparams(a dictionary), allowing for more flexible API requests. Thehitsargument was previously used to control the number of hits per page for GET requests, but this was not an ideal solution. The newparamsargument will allow for more control over GET requests.hitsis greater than 0,params["per_page"]andparams["page"]are set accordingly. Ifhitsis not greater than 0,params['full_result']is set to 'true', which should return all results.api_getmethod to accept the newparamsargument and pass it to the__api_requestmethod.check_productsfunction to use the newparamsargument when making GET requests via theapi_getmethod. Theparamsdictionary is used to pass theorganization_idto the API.-Sand--short-okto control the output display. If-Sis used, only the status is output. If--short-okis used, products are only output if any are not ok.check_productsmethod to respect the new-Sand--short-okoptions when displaying output.Files Changed
ForemanAPIClient.pymain.pyREADME.md