Skip to content

Commit

Permalink
Fix for #43
Browse files Browse the repository at this point in the history
  • Loading branch information
tdorssers committed Oct 27, 2021
1 parent 7c60304 commit 105b0a6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions teslapy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,13 @@ def fetch_token(self):
@staticmethod
def _authenticate(url):
""" Default authenticator method """
logger.debug('Opening %s with default browser', url)
print('Use browser to login. Page Not Found will be shown at success.')
webbrowser.open(url)
try:
webbrowser.get()
logger.debug('Opening %s with default browser', url)
webbrowser.open(url)
except webbrowser.Error:
print('Open this URL to authenticate: ' + url)
return input('Enter URL after authentication: ')

def _cache_load(self):
Expand Down

0 comments on commit 105b0a6

Please sign in to comment.