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

Bump braces from 3.0.2 to 3.0.3 #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
14 changes: 5 additions & 9 deletions guardrails/cli/server/hub_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from typing import Any, Dict, Optional

import requests
from jwt import JWT
from jwt.exceptions import JWTDecodeError
import jwt
from jwt import DecodeError

from guardrails.classes.credentials import Credentials
from guardrails.cli.logger import logger
Expand Down Expand Up @@ -86,13 +86,9 @@ def get_jwt_token(creds: Credentials) -> Optional[str]:
# check for jwt expiration
if token:
try:
JWT().decode(token, do_verify=False)
except JWTDecodeError as e:
# if the error message includes "Expired", then the token is expired
if "Expired" in str(e):
raise ExpiredTokenError(TOKEN_EXPIRED_MESSAGE)
else:
raise InvalidTokenError(TOKEN_INVALID_MESSAGE)
jwt.decode(token, options={"verify_signature": False})
except DecodeError:
raise InvalidTokenError(TOKEN_INVALID_MESSAGE)
return token


Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading