mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
token_updater needs to be an async function
This commit is contained in:
parent
3035d9cfae
commit
545b8ce2f1
1 changed files with 3 additions and 3 deletions
|
|
@ -61,7 +61,7 @@ class GoogleSession(dav.DAVSession):
|
||||||
|
|
||||||
return await super().request(method, path, **kwargs)
|
return await super().request(method, path, **kwargs)
|
||||||
|
|
||||||
def _save_token(self, token):
|
async def _save_token(self, token):
|
||||||
"""Helper function called by OAuth2Session when a token is updated."""
|
"""Helper function called by OAuth2Session when a token is updated."""
|
||||||
checkdir(expand_path(os.path.dirname(self._token_file)), create=True)
|
checkdir(expand_path(os.path.dirname(self._token_file)), create=True)
|
||||||
with atomic_write(self._token_file, mode="w", overwrite=True) as f:
|
with atomic_write(self._token_file, mode="w", overwrite=True) as f:
|
||||||
|
|
@ -81,7 +81,7 @@ class GoogleSession(dav.DAVSession):
|
||||||
"client_id": self._client_id,
|
"client_id": self._client_id,
|
||||||
"client_secret": self._client_secret,
|
"client_secret": self._client_secret,
|
||||||
},
|
},
|
||||||
token_updater=lambda token: self._save_token(token),
|
token_updater=self._save_token,
|
||||||
connector=self.connector,
|
connector=self.connector,
|
||||||
connector_owner=False,
|
connector_owner=False,
|
||||||
)
|
)
|
||||||
|
|
@ -127,7 +127,7 @@ class GoogleSession(dav.DAVSession):
|
||||||
)
|
)
|
||||||
|
|
||||||
# FIXME: Ugly
|
# FIXME: Ugly
|
||||||
self._save_token(self._token)
|
await self._save_token(self._token)
|
||||||
|
|
||||||
|
|
||||||
class GoogleCalendarStorage(dav.CalDAVStorage):
|
class GoogleCalendarStorage(dav.CalDAVStorage):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue