# Connect to Signals within a notebook using the Signals Python SDK
> Enable Signals through Snowplow Console and obtain your access credentials.
> Source: https://docs.snowplow.io/tutorials/signals-interventions/setup/
> Documentation index: https://docs.snowplow.io/llms.txt

[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/snowplow-incubator/signals-interventions-demo/blob/main/attributes_and_interventions.ipynb)

The first step is to set up your Signals connection. Follow the instructions in the [Signals connection documentation](/docs/signals/connection/) to [enable Signals through Snowplow Console](/docs/signals/setup/).

Once your connection is set up, gather the required credentials as described in the [connection credentials section](/docs/signals/connection/reference/#connection-credentials).

## Set up your Jupyter notebook environment

You can use either Google Colab or a local Jupyter notebook environment for this tutorial.

If you want to skip ahead, the **Open in Colab** notebook contains all the Python code you'll need for this tutorial. It is also available as a [Jupyter notebook on GitHub](https://github.com/snowplow-incubator/signals-interventions-demo/blob/main/attributes_and_interventions.ipynb).

### Using Google Colab

You can use the provided notebook, or create your own. To create a new notebook, open a new notebook at [Google Colab](https://colab.research.google.com/).

You'll need to add credentials as Colab secrets. Click the key icon in the left sidebar, and add the required secrets:

- `SP_API_URL`: your Signals API URL
- `SP_API_KEY`: your API key
- `SP_API_KEY_ID`: your API key ID
- `SP_ORG_ID`: your Snowplow Console organization ID

When you run the notebook, it will ask for access to the secrets. Choose to grant access.

If you're using your own notebook, follow these steps:

1. Install the Signals Python SDK:

```python
%pip install snowplow-signals
```

2. Load your credentials in the notebook:

```python
from google.colab import userdata
import os

os.environ["SP_API_URL"] = userdata.get('SP_API_URL')
os.environ["SP_API_KEY"] = userdata.get('SP_API_KEY')
os.environ["SP_API_KEY_ID"] = userdata.get('SP_API_KEY_ID')
os.environ["SP_ORG_ID"] = userdata.get('SP_ORG_ID')
```

### Using local Jupyter

Navigate into your working directory and environment, then follow these steps:

1. Install Jupyter and the Signals SDK:

```bash
pip install jupyter snowplow-signals python-dotenv
```

2. Create a `.env` file in your working directory with your credentials:

```text
SP_API_URL=your_signals_api_url
SP_API_KEY=your_api_key
SP_API_KEY_ID=your_api_key_id
SP_ORG_ID=your_organization_id
```

3. Start Jupyter notebook:

```bash
jupyter notebook
```

4. In your notebook, load the environment variables:

```python
from dotenv import load_dotenv
load_dotenv()
```

## Connect to Signals

Now you're ready to connect to your Signals instance using the Python SDK.

```python
from snowplow_signals import Signals
import os

sp_signals = Signals(
    api_url=os.environ["SP_API_URL"],
    api_key=os.environ["SP_API_KEY"],
    api_key_id=os.environ["SP_API_KEY_ID"],
    org_id=os.environ["SP_ORG_ID"],
)
```

You're now ready to start defining attributes and interventions in Signals.
