Add statistics from response headers for query_multiple #75
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.
The information is already available in the response headers. My goal with this PR is to add them to the QueryMultiple class as instance variables. This way, when a users or groups query is run (for example, in umapi.py in UST), the resulting object includes the meta info about results.
Here, I added the instance variables to track the following for each request made:
_total_count = x-total-count
_page_size = x-page-count
_page_count = x-current-page
_page_number = x-page-size
Since the info is already on the response, no extra work is needed but to track and set them. Using the resulting fields, it is possible to track the progress of a prolonged umapi run - which is especially useful in user sync tool, where runs often exceed several hours. In a separate PR, I will utilize this feature to add the progress logging in UST.
No new tests are added, but existing tests using mock response have been updated to test these fields as well. The travis failure is because of a dependency issue between pyyaml and python 3.4 - not related to these changes.