Open OAuth URL automatically

This commit is contained in:
Markus Unterwaditzer 2015-11-28 21:09:49 +01:00
parent e3e5b3cde4
commit 2f3b2cb4f1

View file

@ -17,6 +17,8 @@ We also use a custom ``data``-URI for the redirect in OAuth:
'''
import webbrowser
import click
from .base import Item, Storage
@ -95,7 +97,8 @@ class Session(object):
authorization_url, state = \
self._session.authorization_url(self.endpoints['oauth'])
click.echo('Go to {}'.format(authorization_url))
click.echo('Opening {} ...'.format(authorization_url))
webbrowser.open(authorization_url)
click.echo('Follow the instructions on the page.')
raise exceptions.UserError('Aborted!')