def __init__(self, oauth, http_client=None, retries=1, no_cache=False):
if no_cache:
cache = None
else:
cache = os.path.join(tempfile.gettempdir(), str(uuid.uuid4()))
self.oauth = oauth
http_client = http_client or httplib2.Http(cache=cache, timeout=20)
http = self.oauth.authorize(http_client)
data_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
with open(os.path.join(data_path, "sheets_discovery.json")) as jd:
self.service = discovery.build_from_document(jload(jd), http=http)
with open(os.path.join(data_path, "drive_discovery.json")) as jd:
self.driveService = discovery.build_from_document(jload(jd), http=http)
self._spreadsheeets = []
self.batch_requests = dict()
self.retries = retries
self.enableTeamDriveSupport = False # if teamdrive files should be included
self.teamDriveId = None # teamdrive to search for spreadsheet
self._fetch_sheets()
评论列表
文章目录