Пример #1
0
    try:
        authorize = get_auth()
        url = authorize.step1_get_auth_url()
    except Exception as e:
        print("Could not produce auth-URL: %s" % (e))
        exit()

    print("To authorize FUSE to use your Google Drive account, visit the "
          "following URL to produce an authorization code:\n\n%s\n" % 
          (url))

# An authorization from the URL needs to be submitted.
elif 'auth' in args and args.auth:
    (auth_storage_file, authcode) = args.auth

    set_auth_cache_filepath(auth_storage_file)

    try:
        authorize = get_auth()
        authorize.step2_doexchange(authcode)

    except (Exception) as e:
        message = ("Authorization failed: %s" % (str(e)))

        logging.exception(message)
        print(message)
        exit()

    print("Authorization code recorded.")

# Mount the service.
Пример #2
0
if 'url' in args and args.url:
    try:
        authorize = get_auth()
        url = authorize.step1_get_auth_url()
    except Exception as e:
        print("Could not produce auth-URL: %s" % (e))
        exit()

    print("To authorize FUSE to use your Google Drive account, visit the "
          "following URL to produce an authorization code:\n\n%s\n" % (url))

# An authorization from the URL needs to be submitted.
elif 'auth' in args and args.auth:
    (auth_storage_file, authcode) = args.auth

    set_auth_cache_filepath(auth_storage_file)

    try:
        authorize = get_auth()
        authorize.step2_doexchange(authcode)

    except (Exception) as e:
        message = ("Authorization failed: %s" % (str(e)))

        logging.exception(message)
        print(message)
        exit()

    print("Authorization code recorded.")

# Mount the service.
Пример #3
0
    return cache.get(_id)


if __name__ == '__main__':
    parser = ArgumentParser()
    parser.add_argument('cred_filepath', help='Credentials file')

    subparsers = parser.add_subparsers(help='subcommand help')
    parser_bypath = subparsers.add_parser('bypath', help='Path-based lookups.')
    parser_bypath.add_argument('path', help='Path to identify')
    parser_byid = subparsers.add_parser('byid', help='Path-based lookups.')
    parser_byid.add_argument('id', help='Specific entry to identify')

    args = parser.parse_args()

    set_auth_cache_filepath(args.cred_filepath)
    Timers.get_instance().set_autostart_default(False)

    if 'id' in args:
        entry = get_by_id(args.id)

    if 'path' in args:
        entry = get_by_path(args.path)

    print(entry)
    print

    data = entry.get_data()

    for _type, _dict in data.iteritems():
        print("[%s]\n" % (_type))
Пример #4
0
    return cache.get(_id)

if __name__ == '__main__':
    parser = ArgumentParser()
    parser.add_argument('cred_filepath', help='Credentials file')

    subparsers = parser.add_subparsers(help='subcommand help')
    parser_bypath = subparsers.add_parser('bypath', help='Path-based lookups.')
    parser_bypath.add_argument('path', help='Path to identify')
    parser_byid = subparsers.add_parser('byid', help='Path-based lookups.')
    parser_byid.add_argument('id', help='Specific entry to identify')

    args = parser.parse_args()

    set_auth_cache_filepath(args.cred_filepath)
    Timers.get_instance().set_autostart_default(False)

    if 'id' in args:
        entry = get_by_id(args.id)
    
    if 'path' in args:
        entry = get_by_path(args.path)

    print(entry)
    print    

    data = entry.get_data()

    for _type, _dict in data.iteritems():
        print("[%s]\n" % (_type))