Skip to content

Commit

Permalink
Merge pull request #320 from andyj29/update-type-checking-in-jwt.py-t…
Browse files Browse the repository at this point in the history
…o-use-isinstance-synxtax-for-consistency
  • Loading branch information
bretterer authored Mar 13, 2023
2 parents dd8da49 + 80ca3d6 commit 9864d58
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions okta/errors/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ class Error:
Base Error Class
"""

def __init__(self, message):
self.message = message
def __init__(self):
self.message = ""

def __repr__(self):
return str({
Expand Down
2 changes: 1 addition & 1 deletion okta/errors/http_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ def __init__(self, url, response_details, response_body):
self.url = url
self.response_headers = response_details.headers
self.stack = ""
super().__init__(f"HTTP {self.status} {response_body}")
self.message = f"HTTP {self.status} {response_body}"
4 changes: 2 additions & 2 deletions okta/errors/okta_api_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ def __init__(self, url, response_details, response_body):
self.headers = response_details.headers
self.stack = ""

super().__init__(f"Okta HTTP {self.status} {self.error_code} "
f"{self.error_summary}\n{error_causes_string}")
self.message = (f"Okta HTTP {self.status} {self.error_code} "
f"{self.error_summary}\n{error_causes_string}")
6 changes: 3 additions & 3 deletions okta/jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def get_PEM_JWK(private_key):

# check if JWK
# String representation of dictionary or dict
if ((type(private_key) == str and private_key.startswith("{")) or
type(private_key) == dict):
if ((isinstance(private_key, str) and private_key.startswith("{")) or
isinstance(private_key, dict)):
# if string repr, convert to dict object
if (type(private_key) == str):
if isinstance(private_key, str):
private_key = literal_eval(private_key)
# Create JWK using dict obj
my_jwk = jwk.construct(private_key, JWT.HASH_ALGORITHM)
Expand Down

0 comments on commit 9864d58

Please sign in to comment.