def auth2(code): flow = get_flow() credentials = flow.step2_exchange(code) print credentials.to_json() storage = Storage('credentials_file') storage.put(credentials)