Gets the user associated with the login / session. Warning: The returned User object is cached. To ensure its attribute are up to date, you need to run .update() on it. Returns: scratchattach.user.User: Object representing the user associated with t
(self)
| 222 | self.ocular_token = token |
| 223 | |
| 224 | def connect_linked_user(self) -> user.User: |
| 225 | """ |
| 226 | Gets the user associated with the login / session. |
| 227 | |
| 228 | Warning: |
| 229 | The returned User object is cached. To ensure its attribute are up to date, you need to run .update() on it. |
| 230 | |
| 231 | Returns: |
| 232 | scratchattach.user.User: Object representing the user associated with the session. |
| 233 | """ |
| 234 | cached = hasattr(self, "_user") |
| 235 | if cached: |
| 236 | cached = self._user is not None |
| 237 | |
| 238 | if not cached: |
| 239 | self._user = self.connect_user(self._username) |
| 240 | assert self._user is not None |
| 241 | return self._user |
| 242 | |
| 243 | def get_linked_user(self) -> user.User: |
| 244 | # backwards compatibility with v1 |