Skip to content

Commit 545b8ce

Browse files
author
Hugo Osvaldo Barrera
committed
token_updater needs to be an async function
1 parent 3035d9c commit 545b8ce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

vdirsyncer/storage/google.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async def request(self, method, path, **kwargs):
6161

6262
return await super().request(method, path, **kwargs)
6363

64-
def _save_token(self, token):
64+
async def _save_token(self, token):
6565
"""Helper function called by OAuth2Session when a token is updated."""
6666
checkdir(expand_path(os.path.dirname(self._token_file)), create=True)
6767
with atomic_write(self._token_file, mode="w", overwrite=True) as f:
@@ -81,7 +81,7 @@ def _session(self):
8181
"client_id": self._client_id,
8282
"client_secret": self._client_secret,
8383
},
84-
token_updater=lambda token: self._save_token(token),
84+
token_updater=self._save_token,
8585
connector=self.connector,
8686
connector_owner=False,
8787
)
@@ -127,7 +127,7 @@ async def _init_token(self):
127127
)
128128

129129
# FIXME: Ugly
130-
self._save_token(self._token)
130+
await self._save_token(self._token)
131131

132132

133133
class GoogleCalendarStorage(dav.CalDAVStorage):

0 commit comments

Comments
 (0)