> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Session.ready

<span id="atoti.Session.ready" />

> *property* Session.ready: [bool](https://docs.python.org/3/library/functions.html#bool)

Whether the session is ready or not.

When `False`, the server will reject most requests made by users without the **ROLE\_ADMIN** role with an HTTP `503 Service Unavailable` status.
This can be used to prevent queries from being made on a session that has not yet finished its initial setup process (tables and cubes creation, data loading, etc).

<Note>
  This property has no impact in the community edition since the **ROLE\_ADMIN** role is always granted.
</Note>

```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
>>> admin_auth = "admin", "passwd"
>>> user_auth = "user", "passwd"
>>> session_config = tt.SessionConfig(ready=False, security=tt.SecurityConfig())
>>> session = tt.Session.start(session_config)
>>> session.ready
False
>>> for (username, password), roles in {
...     admin_auth: {"ROLE_ADMIN"},
...     user_auth: {"ROLE_USER"},
... }.items():
...     session.security.individual_roles[username] = roles
...     session.security.basic_authentication.credentials[username] = password
```

The session starts as not ready so only admins can access it:

```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
>>> import httpx2
>>> ping_path = (
...     f"{session.client.get_path_and_version_id('activeviam/pivot')[0]}/ping"
... )
>>> url = f"{session.url}/{ping_path}"
>>> httpx2.get(url, auth=admin_auth).status_code
200
>>> httpx2.get(url, auth=user_auth).status_code
503
```

Making the session available to all users:

```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
>>> session.ready = True
>>> session.ready
True
>>> httpx2.get(url, auth=admin_auth).status_code
200
>>> httpx2.get(url, auth=user_auth).status_code
200
```

Making the session unavailable to non-admins again:

```pycon theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
>>> session.ready = False
>>> session.ready
False
>>> httpx2.get(url, auth=admin_auth).status_code
200
>>> httpx2.get(url, auth=user_auth).status_code
503
```

<Callout icon="link">
  **See also**:
  [`atoti.SessionConfig.ready`](./atoti.config.SessionConfig#atoti.SessionConfig.ready) to configure the initial value of this property.
</Callout>
