Getting Started with Jupyter Notebooks

The fastest way to get started is to install the JupyterLab Desktop app locally on your computer, and install the Scanner Python SDK into your Jupyter notebook.

Step 1: Download JupyterLab Desktop

Simply download and run the appropriate installer for your OS. You can find download links on the Github page here.

Step 2: Create or open a notebook

Open up the JupyterLab Desktop app. It is often useful to create a directory where you plan to edit your notebooks. Open up that directory in the app, and then create a notebook file.

Step 3: Download the Scanner Python SDK

Note: At the moment, the Scanner Python SDK is under development and hasn't stabilized yet, so it is not yet available in package registries like pypi. You must install it from a URL. The current version of the SDK is this wheel file: scanner_client-0.0.1-py3-none-any.whl.

Option 1: Use pip install directly on the SDK URL

In your Jupyter notebook, you can download and install the SDK by adding this %pip install command to a cell and executing it.

%pip install https://app.scanner.dev/sdks/python/scanner_client-0.0.1-py3-none-any.whl

If you see errors related to SSL certificates (can happen if you are using Visual Studio Code), then you should try Option 2 below.

Option 2: Download the SDK from the URL, then use pip install on the downloaded file

In your terminal, run this command to download the file locally:

wget https://app.scanner.dev/sdks/python/scanner_client-0.0.1-py3-none-any.whl

In your Jupyter notebook, run this command to install the SDK from its path on local disk:

%pip install path/to/scanner_client-0.0.1-py3-none-any.whl

Step 4: Import and configure the Scanner API Client

In your Jupyter notebook, run this command to import the Scanner API client:

from scanner_client import Scanner

In the Scanner UI, visit Settings and copy-paste your API URL and API key. We recommend adding them to environment variables like SCANNER_API_URL and SCANNER_API_KEY.

Once that is done, you can create the Scanner API client in your Jupyter notebook:

scanner = Scanner(
    api_url=os.environ["SCANNER_API_URL"],
    api_key=os.environ["SCANNER_API_KEY"],
)

You are now ready to execute queries and perform investigations.

Last updated