-
Notifications
You must be signed in to change notification settings - Fork 4
fix: ebrains bucket client #49
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
Conversation
test: add test to prevent regression
apdavison
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should note that we have end-to-end tests running on EBRAINS GitLab, but I'm fine with having read-only tests of public buckets also running on GitHub.
ebrains_drive/client.py
Outdated
|
|
||
|
|
||
| def wrap_exchange_seafile_token(): | ||
| def exchnage_oidc_for_seafile(self: "DriveApiClient"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be "exchange" not "exchnage"
ebrains_drive/client.py
Outdated
| kwargs = copy(kwargs) | ||
|
|
||
| if self._seafile_token is None: | ||
| self._seafile_token = exchnage_oidc_for_seafile(self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be "exchange" not "exchnage"
ebrains_drive/client.py
Outdated
| return fn(self, *args, **kwargs) | ||
| except ClientHttpError as e: | ||
| if e.code == 401: | ||
| self._seafile_token = exchnage_oidc_for_seafile(self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be "exchange" not "exchnage"
|
|
||
|
|
||
| _I_AM_A_PUBLIC_BUCKET = "_I_AM_A_PUBLIC_BUCKET" | ||
| _I_AM_A_PUBLIC_BUCKET = object() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain the motivation for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mainly so that user cannot accidentally provide "_I_AM_A_PUBLIC_BUCKET" as a token, no matter now unlikely.
In thie case, even if the user provide object() as token kwarg, the is check will return false.
fixes #48
this is a quick fix. In future, we should introduce: