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

headers are ignored when providing a custom StacIO #430

Closed
gadomski opened this issue Feb 16, 2023 · 0 comments · Fixed by #439
Closed

headers are ignored when providing a custom StacIO #430

gadomski opened this issue Feb 16, 2023 · 0 comments · Fixed by #439
Assignees
Labels
bug Something isn't working
Milestone

Comments

@gadomski
Copy link
Member

In Client.open, the headers argument is ignored if at stac_io is provided:

if stac_io is None:
stac_io = StacApiIO(
headers=headers,
parameters=parameters,
request_modifier=request_modifier,
)

This can lead to surprising behavior when, e.g., using basic authentication with a custom StacIO:

from pystac_client import Client
from pystac_client.stac_api_io import StacApiIO

headers = {"Authorization": "Basic not-a-real-token"}
stac_io = StacApiIO()  # needs to be StacApiIO(headers=headers)
stac_io.session.verify = False
client = Client.open("https://pystac-client.test", headers=headers, stac_io=stac_io)  # headers are silently ignored

This should be fixed to either:

  1. Set headers onto the stac_io, or
  2. Warn/error if headers and stac_io are provided

Option 1 feels right, but let's see which implements better.

@gadomski gadomski added the bug Something isn't working label Feb 16, 2023
@gadomski gadomski added this to the 0.7.0 milestone Feb 16, 2023
@gadomski gadomski self-assigned this Feb 16, 2023
@gadomski gadomski modified the milestones: 0.7.0, 0.6.1 Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant