| 301 | var_sets_since_first: int |
| 302 | |
| 303 | def __init__(self, *, project_id: Optional[Union[int, str]] = None, _session=None): |
| 304 | |
| 305 | # Required internal attributes that every object representing a cloud needs to have (no matter what cloud is represented): |
| 306 | self._session = _session |
| 307 | self.active_connection = False # whether a connection to a cloud variable server is currently established |
| 308 | |
| 309 | self.websocket = websocket.WebSocket(sslopt={"cert_reqs": ssl.CERT_NONE}) |
| 310 | self.recorder = None # A CloudRecorder object that records cloud activity for the values to be retrieved later, |
| 311 | # which will be saved in this attribute as soon as .get_var is called |
| 312 | self.first_var_set = 0.0 |
| 313 | self.last_var_set = 0.0 |
| 314 | self.var_sets_since_first = 0 |
| 315 | |
| 316 | # Set default values for attributes that save configurations specific to the represented cloud: |
| 317 | # (These attributes can be specifically in the constructors of classes inheriting from this base class) |
| 318 | self.ws_shortterm_ratelimit = 0.06667 |
| 319 | self.ws_longterm_ratelimit = 0.1 |
| 320 | self.ws_timeout = 3 # Timeout for send operations (after the timeout, |
| 321 | # the connection will be renewed and the operation will be retried 3 times) |
| 322 | self.allow_non_numeric = False |
| 323 | self.length_limit = 100000 |
| 324 | self.username = "scratchattach" |
| 325 | self.header = None |
| 326 | self.cookie = None |
| 327 | self.origin = None |
| 328 | self.print_connect_message = False |
| 329 | |
| 330 | self.project_id = project_id |
| 331 | |
| 332 | def _assert_auth(self): |
| 333 | if self._session is None: |