mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-08 05:33:34 +00:00
upgrade googleapiclient and oauth2client versions
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
# Copyright 2011 Google Inc.
|
||||
# Copyright 2014 Google Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -43,17 +43,15 @@ The format of the stored data is like so:
|
||||
|
||||
__author__ = 'jbeda@google.com (Joe Beda)'
|
||||
|
||||
import base64
|
||||
import errno
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import threading
|
||||
|
||||
from anyjson import simplejson
|
||||
from oauth2client.client import Storage as BaseStorage
|
||||
from oauth2client.client import Credentials
|
||||
from oauth2client.client import Storage as BaseStorage
|
||||
from oauth2client import util
|
||||
from locked_file import LockedFile
|
||||
from oauth2client.locked_file import LockedFile
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -286,7 +284,7 @@ class _MultiStore(object):
|
||||
if self._warn_on_readonly:
|
||||
logger.warn('The credentials file (%s) is not writable. Opening in '
|
||||
'read-only mode. Any refreshed credentials will only be '
|
||||
'valid for this run.' % self._file.filename())
|
||||
'valid for this run.', self._file.filename())
|
||||
if os.path.getsize(self._file.filename()) == 0:
|
||||
logger.debug('Initializing empty multistore file')
|
||||
# The multistore is empty so write out an empty file.
|
||||
@ -315,7 +313,7 @@ class _MultiStore(object):
|
||||
"""
|
||||
assert self._thread_lock.locked()
|
||||
self._file.file_handle().seek(0)
|
||||
return simplejson.load(self._file.file_handle())
|
||||
return json.load(self._file.file_handle())
|
||||
|
||||
def _locked_json_write(self, data):
|
||||
"""Write a JSON serializable data structure to the multistore.
|
||||
@ -329,7 +327,7 @@ class _MultiStore(object):
|
||||
if self._read_only:
|
||||
return
|
||||
self._file.file_handle().seek(0)
|
||||
simplejson.dump(data, self._file.file_handle(), sort_keys=True, indent=2)
|
||||
json.dump(data, self._file.file_handle(), sort_keys=True, indent=2, separators=(',', ': '))
|
||||
self._file.file_handle().truncate()
|
||||
|
||||
def _refresh_data_cache(self):
|
||||
@ -387,7 +385,7 @@ class _MultiStore(object):
|
||||
raw_key = cred_entry['key']
|
||||
key = util.dict_to_tuple_key(raw_key)
|
||||
credential = None
|
||||
credential = Credentials.new_from_json(simplejson.dumps(cred_entry['credential']))
|
||||
credential = Credentials.new_from_json(json.dumps(cred_entry['credential']))
|
||||
return (key, credential)
|
||||
|
||||
def _write(self):
|
||||
@ -400,7 +398,7 @@ class _MultiStore(object):
|
||||
raw_data['data'] = raw_creds
|
||||
for (cred_key, cred) in self._data.items():
|
||||
raw_key = dict(cred_key)
|
||||
raw_cred = simplejson.loads(cred.to_json())
|
||||
raw_cred = json.loads(cred.to_json())
|
||||
raw_creds.append({'key': raw_key, 'credential': raw_cred})
|
||||
self._locked_json_write(raw_data)
|
||||
|
||||
|
Reference in New Issue
Block a user