Skip to content

Commit

Permalink
Gmail: creds_file param reversion fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyephron committed Jan 16, 2021
1 parent a213943 commit 66e776d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setuptools.setup(
name="simplegmail",
version="3.1.3",
version="3.1.5",
url="https://github.com/jeremyephron/simplegmail",
author="Jeremy Ephron",
author_email="[email protected]",
Expand Down
7 changes: 4 additions & 3 deletions simplegmail/gmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,24 @@ class Gmail(object):
# If you don't have a client secret file, follow the instructions at:
# https://developers.google.com/gmail/api/quickstart/python
# Make sure the client secret file is in the root directory of your app.
_CREDENTIALS_FILE = 'gmail_token.json'

def __init__(
self,
client_secret_file: str = 'client_secret.json',
creds_file: str = 'gmail_token.json',
_creds: Optional[client.Credentials] = None
) -> None:
self.client_secret_file = client_secret_file
self.creds_file = creds_file

try:
# The file gmail-token.json stores the user's access and refresh
# The file gmail_token.json stores the user's access and refresh
# tokens, and is created automatically when the authorization flow
# completes for the first time.
if _creds:
self.creds = _creds
else:
store = file.Storage(self._CREDENTIALS_FILE)
store = file.Storage(self.creds_file)
self.creds = store.get()

if not self.creds or self.creds.invalid:
Expand Down

0 comments on commit 66e776d

Please sign in to comment.