Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow http headers on cli #238

Merged
merged 2 commits into from
Nov 4, 2024
Merged

Allow http headers on cli #238

merged 2 commits into from
Nov 4, 2024

Conversation

gadomski
Copy link
Member

@gadomski gadomski commented Nov 4, 2024

Related issues and pull requests

Description

Add --http-header, which can be specified multiple times, to CLI.

@scottyhq your example would then look like:

stac-client search https://api.canopy.umbra.space/v2/stac/ \
   --headers "authorization=Bearer $UMBRA_API_TOKEN" \
   --query "umbra:task_id=644cc5e9-8702-44d8-a154-235d3c8233f2" \
   | stac-asset download \
         --http-header "authorization=Bearer $UMBRA_API_TOKEN" \
         -i "2024-10-28-19-13-59_UMBRA-08_MM.tif"

Can you check this branch and see if that works for you? 🙇🏼

Checklist

  • Add tests
  • Add docs
  • Update CHANGELOG

@gadomski gadomski self-assigned this Nov 4, 2024
@scottyhq
Copy link

scottyhq commented Nov 4, 2024

Thanks @gadomski I just tested and it 'works' in that the flag is picked up... but then I realized what I was really looking for was --alternate-assets s3_signed since the Token required for search does not seem to be the same Token required to access S3:// links directly... So in the end I am able to use the released v0.4.5 after all! 🤦

@gadomski
Copy link
Member Author

gadomski commented Nov 4, 2024

Sweet! Still a useful flag to add but glad you were able to do what you want. alternate-assets is a bit under-documented but pretty useful if folks are providing STAC that way, glad you dug it out.

Copy link
Member

@ircwaves ircwaves left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This is another welcome addition.

src/stac_asset/_cli.py Show resolved Hide resolved
@gadomski gadomski enabled auto-merge (squash) November 4, 2024 18:55
@gadomski gadomski merged commit fa1d83d into main Nov 4, 2024
10 checks passed
@gadomski gadomski deleted the issues/237-headers-cli branch November 4, 2024 18:55
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 for http_headers config in CLI for authentication
3 participants