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

switch to pystac client and add way to forward headers to the stac-api #16

Merged
merged 2 commits into from
Apr 11, 2024

Conversation

vincentsarago
Copy link
Member

closes #11
closes #10
closes #9

This PR does:

  • switch from httpx to pystac-client to fetch Item
  • use StacApiIO for retry mechanism
  • enable forwarding headers to the stac-api requests
  • refactor input parameters for the mosaic backend

@@ -117,7 +119,8 @@ class STACAPIBackend(BaseBackend):
"""STACAPI Mosaic Backend."""

# STAC API URL
input: str = attr.ib()
url: str = attr.ib()
headers: Dict = attr.ib(factory=dict)
Copy link
Member Author

Choose a reason for hiding this comment

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

the mosaic backend nows take url and headers as input

@@ -244,7 +254,11 @@ def get_assets(
}
params.pop("bbox", None)

results = catalog.search(**params)
results = ItemSearch(
Copy link
Member Author

Choose a reason for hiding this comment

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

we use ItemSearch to avoid using Client.open which will first fetch the landing page first

"""Return STAC API Parameters."""
return APIParams(
api_url=request.app.state.stac_url,
)
Copy link
Member Author

Choose a reason for hiding this comment

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

Here user could add Auth and also set headers to be forwarded to the stacAPI endpoints

@vincentsarago vincentsarago merged commit a684d8d into main Apr 11, 2024
6 checks passed
@vincentsarago vincentsarago deleted the feature/use-pystac-client branch April 11, 2024 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant