Skip to content

Commit

Permalink
Fix Github issue #6 (uncaught exception)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpignet committed May 12, 2020
1 parent bdca16e commit 4c91d82
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions custom_components/tplink_router/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,11 @@ def _get_pub_key(self):
ee = self._get_field_from_router_response(response.text, 'ee')
nn = self._get_field_from_router_response(response.text, 'nn')

e = int(ee, 16)
n = int(nn, 16) #snipped for brevity
try:
e = int(ee, 16)
n = int(nn, 16) #snipped for brevity
except ValueError:
return False

pubkey = construct((n, e))
self.pubkey = PKCS1_v1_5.new(pubkey)
Expand Down Expand Up @@ -568,8 +571,8 @@ def _get_token(self):

def _get_auth_tokens(self):
"""Retrieve auth tokens from the router."""
_LOGGER.info("Retrieving PublicKey...")

_LOGGER.info("Retrieving PublicKey...")
pubkey = self._get_pub_key()
if not pubkey:
return False
Expand Down

0 comments on commit 4c91d82

Please sign in to comment.