diff options
author | Danny Hermes <daniel.j.hermes@gmail.com> | 2016-02-19 17:50:37 -0800 |
---|---|---|
committer | Danny Hermes <daniel.j.hermes@gmail.com> | 2016-02-19 17:50:37 -0800 |
commit | 98df500a29157ccaa3f6bdf4517d57a5be8e85f1 (patch) | |
tree | b07ed9a371cfce4e985e99d03a54b9bc1f067467 /oauth2client | |
parent | d5f41392b20599fec55b8ac8611646c1ad93a5d7 (diff) | |
download | oauth2client-98df500a29157ccaa3f6bdf4517d57a5be8e85f1.tar.gz |
Allowing default flags in run_flow().
Diffstat (limited to 'oauth2client')
-rw-r--r-- | oauth2client/tools.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/oauth2client/tools.py b/oauth2client/tools.py index aa40b9e..0ba8449 100644 --- a/oauth2client/tools.py +++ b/oauth2client/tools.py @@ -113,7 +113,7 @@ class ClientRedirectHandler(BaseHTTPServer.BaseHTTPRequestHandler): @util.positional(3) -def run_flow(flow, storage, flags, http=None): +def run_flow(flow, storage, flags=None, http=None): """Core code for a command-line application. The ``run()`` function is called from your application and runs @@ -154,15 +154,18 @@ def run_flow(flow, storage, flags, http=None): Args: flow: Flow, an OAuth 2.0 Flow to step through. storage: Storage, a ``Storage`` to store the credential in. - flags: ``argparse.Namespace``, The command-line flags. This is the - object returned from calling ``parse_args()`` on - ``argparse.ArgumentParser`` as described above. + flags: ``argparse.Namespace``, (Optional) The command-line flags. This + is the object returned from calling ``parse_args()`` on + ``argparse.ArgumentParser`` as described above. Defaults + to ``argparser.parse_args()``. http: An instance of ``httplib2.Http.request`` or something that acts like it. Returns: Credentials, the obtained credential. """ + if flags is None: + flags = argparser.parse_args() logging.getLogger().setLevel(getattr(logging, flags.logging_level)) if not flags.noauth_local_webserver: success = False |