Created
March 12, 2015 06:10
-
-
Save cablehead/668a410b464642c81870 to your computer and use it in GitHub Desktop.
Google API OAuth from Command Line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
from oauth2client.client import flow_from_clientsecrets | |
from oauth2client.file import Storage | |
from oauth2client import tools | |
def main(): | |
storage = Storage('a_credentials_file') | |
creds = storage.get() | |
print dir(creds) | |
return | |
flow = flow_from_clientsecrets( | |
'client_secrets.json', | |
scope='https://spreadsheets.google.com/feeds') | |
parser = argparse.ArgumentParser(parents=[tools.argparser]) | |
flags = parser.parse_args() | |
credentials = tools.run_flow(flow, storage, flags) | |
print credentials | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment