From 2f3b2cb4f12a28dec861bb97a1e1140dc2584585 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Sat, 28 Nov 2015 21:09:49 +0100 Subject: [PATCH] Open OAuth URL automatically --- vdirsyncer/storage/remotestorage.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vdirsyncer/storage/remotestorage.py b/vdirsyncer/storage/remotestorage.py index a1499c1..ffa4187 100644 --- a/vdirsyncer/storage/remotestorage.py +++ b/vdirsyncer/storage/remotestorage.py @@ -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!')