Beispiel #1
0
def setup_google():
    global client

    out = True
    try:
        # Create a client class which will make HTTP requests with Google Docs server.
        configdir = os.path.expanduser('./')
        client_secrets = os.path.join(configdir, 'OpenSelfie.json')
        credential_store = os.path.join(configdir, 'credentials.dat')

        client = OAuth2Login(client_secrets, credential_store, config.username)

    except KeyboardInterrupt:
        raise
    except Exception, e:
        print 'could not login to Google, check .credential file\n   %s' % e
        out = False
Beispiel #2
0
def getAlbums(email):

    # options for oauth2 login
    configdir = os.path.expanduser('./')
    client_secrets = os.path.join(configdir, 'OpenSelfie.json')
    credential_store = os.path.join(configdir, 'credentials.dat')

    gd_client = OAuth2Login(client_secrets, credential_store, email)

    albums = gd_client.GetUserFeed()
    entries = []
    for album in albums.entry:
        title = album.title.text
        title = ''.join([c for c in title if ord(c) < 128])
        id = album.gphoto_id.text
        entry = '%s::%s' % (title, id)
        entries.append(entry)
    return entries