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

Make navigate() and navigate_url() auto-authenticate for embargoed Dandisets #870

Merged
merged 3 commits into from
Jan 24, 2022

Conversation

jwodder
Copy link
Member

@jwodder jwodder commented Jan 20, 2022

Closes #867.

Nonfunctional without dandi/dandi-archive#831.

@jwodder jwodder added the minor Increment the minor version when merged label Jan 20, 2022
@codecov
Copy link

codecov bot commented Jan 20, 2022

Codecov Report

Merging #870 (8e9afbe) into master (46d1ea2) will decrease coverage by 0.07%.
The diff coverage is 48.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #870      +/-   ##
==========================================
- Coverage   86.60%   86.53%   -0.08%     
==========================================
  Files          58       58              
  Lines        6071     6097      +26     
==========================================
+ Hits         5258     5276      +18     
- Misses        813      821       +8     
Flag Coverage Δ
unittests 86.53% <48.27%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
dandi/dandiarchive.py 84.12% <48.27%> (-2.36%) ⬇️
dandi/dandiapi.py 90.59% <0.00%> (+0.17%) ⬆️

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 46d1ea2...8e9afbe. Read the comment docs.

Copy link
Member

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

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

minor requests:

  • adjust docstrings to not limit to embargoed
  • ideally -- remove code duplication?

dandi/dandiarchive.py Outdated Show resolved Hide resolved
client.dandi_authenticate()
assets = list(self.get_assets(client, strict=strict))
else:
raise
Copy link
Member

Choose a reason for hiding this comment

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

we were in a similar position somewhere else with code duplication, but forgot how we solved it (if we did) -- feels like needing some helper/decorator but its operation would depend on the value of authenticate kwarg. I guess decorator could get it from the invocation's kwargs (and better to position strict and authenticate after * to ensure use of kwarg instead of posarg). Also relating to the suggestion for docstring, it is just an assumption that it is "embargoed" if 401 -- might be some new feature or a bug etc whenever API would return 401 so might be better to adjust log message to correspond situation better.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't feel the code is repeated enough to warrant the complexity of adding a decorator.

dandi/dandiarchive.py Outdated Show resolved Hide resolved
jwodder and others added 2 commits January 21, 2022 09:57
Co-authored-by: Yaroslav Halchenko <debian@onerussian.com>
@yarikoptic yarikoptic added the release Create a release when this pr is merged label Jan 24, 2022
@yarikoptic yarikoptic merged commit f6ad4e1 into master Jan 24, 2022
@yarikoptic yarikoptic deleted the gh-867 branch January 24, 2022 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged release Create a release when this pr is merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Call dandi_authenticate() during dandi download
2 participants