Skip to content

Update to newest version of ESS-DIVE Dataset API#21

Merged
caufieldjh merged 2 commits into
mainfrom
16-update-to-newest-version-of-ess-dive-dataset-api
May 9, 2026
Merged

Update to newest version of ESS-DIVE Dataset API#21
caufieldjh merged 2 commits into
mainfrom
16-update-to-newest-version-of-ess-dive-dataset-api

Conversation

@caufieldjh

Copy link
Copy Markdown
Contributor

This pull request improves the handling of authentication for ESS-DIVE metadata access, making public metadata retrieval possible without a token and clarifying related documentation and error handling. The code now gracefully supports both anonymous and authenticated requests, and the test suite has been expanded to verify these behaviors.

Authentication and API request handling:

  • Refactored the ESS-DIVE API wrapper (essdive.py) to allow anonymous public metadata access by omitting the Authorization header when no valid token is provided. Added helper functions normalize_essdive_token and _essdive_headers for robust token normalization and header construction. The API now accepts both DOI and ESS-DIVE package identifiers and correctly encodes them for requests. [1] [2] [3] [4]

CLI and error handling improvements:

  • Removed mandatory token checks from the CLI (cli.py), so commands no longer fail if ESSDIVE_TOKEN is unset, enabling public metadata retrieval without authentication. [1] [2]

Documentation updates:

  • Updated README.md to clarify that a token is only needed for non-public datasets, revised environment variable instructions, and improved troubleshooting guidance for authenticated access. [1] [2] [3] [4]

Testing enhancements:

  • Expanded the test suite (test_essdive_api.py) to cover anonymous access, token normalization, inclusion/omission of the Authorization header, and support for both DOI and ESS-DIVE package identifiers. [1] [2] [3]

@caufieldjh caufieldjh linked an issue May 8, 2026 that may be closed by this pull request
@caufieldjh caufieldjh merged commit c9220d4 into main May 9, 2026
2 checks passed
@caufieldjh caufieldjh deleted the 16-update-to-newest-version-of-ess-dive-dataset-api branch May 9, 2026 12:31
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.

Update to newest version of ESS-DIVE Dataset API

1 participant