def _get_credentials(self):
"""Gets valid user credentials from storage.
If nothing has been stored, or if the stored credentials are invalid,
the OAuth2 flow is completed to obtain the new credentials.
Returns:
Credentials, the obtained credential.
"""
store = Storage(self._credentials_file)
credentials = store.get()
if not credentials or credentials.invalid:
raise Exception(
"Could not find Google Mail credentials at %s" % self._credentials_file)
return credentials
评论列表
文章目录