Skip to content

feat: add client_id() header method and multi-platform search support#111

Open
stark256-spec wants to merge 1 commit into
nasa:developfrom
stark256-spec:feat/platform-multi-and-client-id
Open

feat: add client_id() header method and multi-platform search support#111
stark256-spec wants to merge 1 commit into
nasa:developfrom
stark256-spec:feat/platform-multi-and-client-id

Conversation

@stark256-spec
Copy link
Copy Markdown

Closes #49, closes #80.

Changes

client_id() method on Query (fixes #49)

Adds a client_id(client_id=None) convenience method to the Query base class, analogous to token() and bearer_token(), that sets the Client-Id header described in the CMR Search API docs.

  • Without an argument (or None): sets Client-Id: python_cmr-<version> so that NASA Operations can identify requests from this library automatically.
  • With a string argument: sets Client-Id: <your-app>/python_cmr-<version>, appending the library version for traceability.
query = CollectionQuery().client_id()             # Client-Id: python_cmr-0.14.0
query = CollectionQuery().client_id("my-tool")   # Client-Id: my-tool/python_cmr-0.14.0

Multi-platform support in platform() (fixes #80)

Updates GranuleCollectionBaseQuery.platform() to accept either a single string or a list of strings, matching CMR's native support for filtering by multiple platforms.

# single platform (existing behaviour preserved)
query.platform("Terra")

# multiple platforms
query.platform(["Terra", "Aqua"])

Tests

  • 3 new tests in tests/test_queries.py covering client_id() default, custom name, and header isolation.
  • 2 new tests (one per GranuleQuery and CollectionQuery) for multi-platform lists.
  • Existing single-platform assertions updated to reflect the new list storage format.

- Add Query.client_id() convenience method that sets the Client-Id
  header. When called without arguments it defaults to
  python_cmr-<version>; when called with a name it produces
  <name>/python_cmr-<version>. Closes nasa#49.

- Update GranuleCollectionBaseQuery.platform() to accept either a
  single string or a list of strings, matching CMR's support for
  multi-platform filtering. Closes nasa#80.
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.

Support searching by multiple platforms Provide convenience method for adding a client-id header

1 participant