Skip to content

Commit

Permalink
Use consistent arguments in generic API exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Terrance committed Sep 1, 2024
1 parent 7f582a1 commit 85f0ec5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 4 additions & 3 deletions skpy/conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,11 @@ def auth(self, user, pwd):
"""
# Wrap up the credentials ready to send.
pwdHash = base64.b64encode(hashlib.md5((user + "\nskyper\n" + pwd).encode("utf-8")).digest()).decode("utf-8")
json = self.conn("POST", "{0}/login/skypetoken".format(SkypeConnection.API_USER),
json={"username": user, "passwordHash": pwdHash, "scopes": "client"}).json()
resp = self.conn("POST", "{0}/login/skypetoken".format(SkypeConnection.API_USER),
json={"username": user, "passwordHash": pwdHash, "scopes": "client"})
json = resp.json()
if "skypetoken" not in json:
raise SkypeAuthException("Couldn't retrieve Skype token from response")
raise SkypeAuthException("Couldn't retrieve Skype token from response", resp)
expiry = None
if "expiresIn" in json:
expiry = datetime.fromtimestamp(int(time.time()) + int(json["expiresIn"]))
Expand Down
3 changes: 1 addition & 2 deletions skpy/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ class SkypeAuthException(SkypeException):
"""
An exception thrown when authentication cannot be completed.
Arguments will usually be of the form (``message``, ``response``). If the server provided an error message, it
will be present in a third argument.
Arguments will be of the form (``message``, ``response``).
Unfortunately there are many possible reasons why a login may be rejected, including but not limited to:
Expand Down

0 comments on commit 85f0ec5

Please sign in to comment.