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

Add headers to read_text as an optional field #333

Open
waystilos opened this issue Jul 25, 2022 · 0 comments
Open

Add headers to read_text as an optional field #333

waystilos opened this issue Jul 25, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@waystilos
Copy link

waystilos commented Jul 25, 2022

Is your feature request related to a problem? Please describe.

When generating a stac item in my current project, instead of creating a SAS token and appending it to a URL, I would like to pass an Auth header to read_text() which would eventually get passed down to urllib.request. Maybe something like this already exists and I'm missing it.

The current code looks like this:

if fgdc_metadata_href is not None:
            fgdc_metadata_text = read_text(
                fgdc_metadata_href, fgdc_url_func)
            fgdc = parse_fgdc_metadata(fgdc_metadata_text)
        else:
            fgdc = {}

Describe the solution you'd like

Maybe something like this where you pass in the headers

if fgdc_metadata_href is not None:
            fgdc_metadata_text = read_text(
                fgdc_metadata_href, headers)
            fgdc = parse_fgdc_metadata(fgdc_metadata_text)
        else:
            fgdc = {}

Describe alternatives you've considered

I've downloaded the metadata file locally and added the absolute path to read_text but it has perf issues and also would like to have a URL in the stac item.

@waystilos waystilos added the enhancement New feature or request label Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant