INNER CODE UNIT · Python

__getattribute__

Squarespace/datasheets · datasheets/client.py:59

    def __getattribute__(self, attr):
        """Get an attribute (variable or method) of this instance of this class

        For client OAuth, before each user-facing method call this method will verify that the
        access token is not expired and refresh it if it is.

        We only refresh on user-facing method calls since otherwise we'd be refreshing multiple
        times per user action (once for the user call, possibly multiple times for the private
        method calls invoked by it).
        """
        requested_attr = super(Client, self).__getattribute__(attr)

        if isinstance(requested_attr, types.MethodType) \
           and not attr.startswith('_'):
            self._refresh_token_if_needed()

        return requested_attr

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…