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 query parameters #118

Merged
merged 5 commits into from
Nov 18, 2021

Conversation

duckontheweb
Copy link
Collaborator

@duckontheweb duckontheweb commented Nov 11, 2021

Related Issue(s):

Description:

Adds a parameters argument to StacApiIO.__init__, Client.from_file, and Client.open to allow query string parameters to be added to all requests from that instance in the same way that the headers argument adds headers to each request. This will make it easier for users to interact with APIs that use an API in the query string (e.g. Radiant MLHub).

Note that this PR also adds requests-mock as a dev dependency because it seemed like a simpler way to construct unit tests for these I/O operations.

PR Checklist:

  • Code is formatted
  • Tests pass
  • Changes are added to the CHANGELOG

duckontheweb added a commit to duckontheweb/pystac-client that referenced this pull request Nov 11, 2021
@matthewhanson
Copy link
Member

@duckontheweb this looks like a good feature addition to me for APIs that might support non-standard parameters. Was wondering what the use case is that precipitated it, is it for authentication?

Can you resolve the conflicts that arose after merging the other PRs and I'll get this in to make a release today

@duckontheweb
Copy link
Collaborator Author

@duckontheweb this looks like a good feature addition to me for APIs that might support non-standard parameters. Was wondering what the use case is that precipitated it, is it for authentication?

Yes, that's right. We use a key query parameter to pass API keys to the MLHub API, which is what precipitated the change.

Can you resolve the conflicts that arose after merging the other PRs and I'll get this in to make a release today

Just rebased this and pushed the changes, so you should be good to go. Thanks for the quick turnaround!

@codecov-commenter
Copy link

Codecov Report

Merging #118 (a01f4c8) into main (17d3909) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #118      +/-   ##
==========================================
+ Coverage   79.96%   80.00%   +0.03%     
==========================================
  Files           9        9              
  Lines         544      545       +1     
==========================================
+ Hits          435      436       +1     
  Misses        109      109              
Impacted Files Coverage Δ
pystac_client/client.py 81.81% <100.00%> (ø)
pystac_client/stac_api_io.py 82.24% <100.00%> (+0.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 17d3909...a01f4c8. Read the comment docs.

@matthewhanson matthewhanson merged commit 89dfe75 into stac-utils:main Nov 18, 2021
@duckontheweb duckontheweb deleted the add/117-query-param-auth branch November 23, 2021 01:59
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 query parameter authentication
4 participants