INNER CODE UNIT · Python

_refresh_token_if_needed

Squarespace/datasheets · datasheets/client.py:89

    def _refresh_token_if_needed(self):
        if not self.is_service or self.credentials.expired:
            self.credentials.refresh(Request())

    def _retrieve_client_credentials(self):
        """Get valid user credentials

        If storage=True, then first look in ``$DATASHEETS_CREDENTIALS_PATH``
        (default: ``~/.datasheets/client_credentials.json``) to see if authorized credentials have
        been stored. The client credentials are basically an access token that expires. If nothing
        has been stored or if the stored credentials are invalid, the OAuth2 flow is completed to
        obtain new credentials using the client secrets as the means of verifying that the user
        should be granted access. The resulting credentials will be stored at that same path unless
        storage=False, in which case the OAuth2 flow will be executed to obtain new user
        credentials regardless but the credentials will not be stored. The storage=False mode
        deliberately does not store credentials to disk in order to allow for use of the library
        in multi-user environments.
        """

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…