Pass configured headers to tool, service and variable queries - #124
Open
sylvesterkaczmarek wants to merge 1 commit into
Open
sylvesterkaczmarek wants to merge 1 commit into
sylvesterkaczmarek wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #122.
Changes
Pass
headers=self.headersinToolServiceVariableBaseQuery.get, covering ToolQuery, ServiceQuery and VariableQuery. The configured token, bearer token and custom headers now reach every paginated request, matching the other Query request methods.The production change only forwards the existing header mapping. Current pagination, JSON/XML response handling, empty results and HTTP exceptions are unchanged. This does not add a client-ID convenience API or alter the separate results iterator.
Validation
Add 18 offline cases across the three query classes. They inspect actual prepared Requests objects at the mocked send boundary, including first and subsequent pages, both token methods, custom headers, XML output, no-header defaults, empty results and HTTP errors. Tests prevent loading credentials from the runner's netrc file.
All 147 repository tests pass locally on macOS arm64 with Python 3.12.11 using the repository-locked HTTP/VCR versions. Mypy passes for all 11 source/test modules, the repository's gating flake8 rules pass, and the new test file passes full flake8.
git diff --checkpasses.Exact-commit hosted validation passes on Ubuntu 24.04 with Python 3.8, 3.10 and 3.12, using Poetry 1.8.2 and the unmodified
poetry.lock, against67bbf5603951f198663fcce505a69fdca61accd8. Each job passes the full 147-test suite and type/lint checks, restores the originalqueries.pyto reproduce 12 failures alongside six passing controls, then restores the submitted source byte-for-byte and passes all 147 tests again. Logs are retained as artifacts.The existing VCR recordings are replayed with live socket access disabled. Initial testing with newer, unlocked urllib3/VCR combinations reproduced 13 existing fixture incompatibilities; the repository-locked environment passes the unchanged upstream suite and the updated suite. No dependency or fixture changes are included.
Scope
No live CMR queries, real authentication tokens, Earthdata downloads or deployment changes. The validation workflow is on a separate fork branch and is not included in this PR. Only
cmr/queries.pyand the new regression test file are changed.