Skip to content

Commit

Permalink
Merge pull request #2755 from activeloopai/revert_public_token_handling
Browse files Browse the repository at this point in the history
Revert public token handling until future release
  • Loading branch information
nvoxland-al committed Feb 1, 2024
2 parents e91a754 + 9eedfd7 commit 85c5185
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions deeplake/client/client.py
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

0 comments on commit 85c5185

Please sign in to comment.