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

Revert public token handling until future release #2755

Merged
merged 3 commits into from
Feb 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions deeplake/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
HUB_REST_ENDPOINT,
HUB_REST_ENDPOINT_LOCAL,
HUB_REST_ENDPOINT_DEV,
GET_TOKEN_SUFFIX,
HUB_REST_ENDPOINT_STAGING,
REGISTER_USER_SUFFIX,
DEFAULT_REQUEST_TIMEOUT,
Expand Down Expand Up @@ -187,10 +188,15 @@ def request_auth_token(self, username: str, password: str):
LoginException: If there is an issue retrieving the auth token.
"""
if username != "public":
raise LoginException("Can only request a token for the public user")
json = {"username": username, "password": password}
response = self.request("POST", GET_TOKEN_SUFFIX, json=json)

return "PUBLIC TOKEN " + ("_" * 150)
try:
token_dict = response.json()
token = token_dict["token"]
except Exception:
raise LoginException()
return token

def send_register_request(self, username: str, email: str, password: str):
"""Sends a request to backend to register a new user.
Expand Down
Loading