Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
OAuth 2.0 authorization borrowed from
import os
import time
import httplib2
## installed with pip install --upgrade oauth2client (or some other way)
from oauth2client import client
def oauthLogin():
# using
from oauth2client.file import Storage
filename = os.path.join(os.path.expanduser('~'), ".picasawebsync")
client_secrets = os.path.join(os.path.expanduser('~'), ".config", "picasawebsync.json")
storage = Storage(filename)
credentials = storage.get()
if credentials is None or credentials.invalid:
flow = client.flow_from_clientsecrets(client_secrets,
auth_uri = flow.step1_get_authorize_url()
print 'Authorization URL: %s' % auth_uri
auth_code = raw_input('Enter the auth code: ')
credentials = flow.step2_exchange(auth_code)
if credentials.access_token_expired:
return credentials.access_token
# start of the program
gd_client = oauthLogin()
print '%s' % gd_client

This comment has been minimized.

Copy link

goodevilgenius commented Aug 18, 2015

raise InvalidClientSecretsError('File not found: "%s"' % filename)

How is client_secrets supposed to be written? This is clearly missing something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.