Skip to main content

pypi run-tests Codacy Badge Coverage Status

tom_scimma

This module adds Hopskotch and Skip support to the TOM Toolkit. Using this module, TOMs can query alerts submitted to the Hopskotch stream, and publish alerts to Hopskotch.

Installation

Install the module into your TOM environment:

pip install tom-scimma

Add tom_scimma.scimma.SCIMMABroker to the TOM_ALERT_CLASSES in your TOM's settings.py:

TOM_ALERT_CLASSES = [
    'tom_alerts.brokers.mars.MARSBroker',
    ...
    'tom_scimma.scimma.SCIMMABroker'
]

Though Skip alerts are public (for now), you'll need Hopskotch credentials to submit alerts. You can register for an account here. Add the appropriate Skip and Hopskotch credentials to your project's settings.py:

    BROKERS = {
        'SCIMMA': {
            'url': 'http://skip.dev.hop.scimma.org',
            'api_key': os.getenv('SKIP_API_KEY', ''),
            'hopskotch_url': 'dev.hop.scimma.org',
            'hopskotch_username': os.getenv('HOPSKOTCH_USERNAME', ''),
            'hopskotch_password': os.getenv('HOPSKOTCH_PASSWORD', ''),
            'default_hopskotch_topic': ''
        }
    }

Configurable settings

url: The URL for Skip requests, i.e. for retrieving alerts.

api_key: The API key used to authenticate/authorize with Skip. Currently unused.

hopskotch_url: The URL for Hopskotch broker submissions, i.e. submitting alerts.

hopskotch_username: The username used to authenticate with Hopskotch.

hopskotch_password: The password used to authenticate with Hopskotch.

default_hopskotch_topic: The Hopskotch topic to submit alerts to when none is provided.

Available templatetags

Though the TOM Toolkit provides a broker submission templatetag, tom_scimma provides an additional templatetag that includes a keyword argument for topic. To use it,

Add tom_scimma to your settings.INSTALLED_APPS:

    INSTALLED_APPS = [
        'django.contrib.admin',
        'django.contrib.auth',
        ...
        'tom_scimma'
    ]

Then, add scimma_extras to the {% load ... %} statement of your desired template:

    {% load bootstrap4 targets_extras ... scimma_extras %}

Finally, add your desired templatetag where you would like it in your template:

    {% submit_upstream_scimma_form target observation_record redirect_url topic_name %}

The signature and docstring of the submit_upstream_to_scimma button are as follows:

```
def submit_upstream_scimma_form(target=None, observation_record=None, redirect_url=None, topic=None):
    """
    Renders a button to submit an alert upstream to a broker. At least one of target/obs record should be given.

    :param broker: The name of the broker to which the button will lead, as in the name field of the broker module.
    :type broker: str

    :param target: The target to be submitted as an alert, if any.
    :type target: ``Target``

    :param observation_record: The observation record to be submitted as an alert, if any.
    :type observation_record: ``ObservationRecord``

    :param topic: The topic to submit the alerts to.
    :type topic: str

    :param redirect_url:
    :type redirect_url: str
    """
```

Running the tests

In order to run the tests, run the following in your virtualenv:

python tom_scimma/tests/run_tests.py

Metadata

Release files for tom-scimma 1.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tom-scimma 1.1.6
File Size Uploaded
tom-scimma-1.1.6.tar.gz 25.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tom-scimma 1.1.6
File Interpreter ABI Platform
tom_scimma-1.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 49.9 kB

Release files / tom-scimma-1.1.6.tar.gz

Download URL tom-scimma-1.1.6.tar.gz
Size 25.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7362b9606c9b17d421b49cbc33a1fa05de328ed3614e9a1cf5fec9f0d81ce192
BLAKE2b-256 checksum
How to use checksums
9f5b4280ac15db3aacb2259edfb8c0dc5035541db6752448eeded66debec3751
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release files / tom_scimma-1.1.6-py3-none-any.whl

Download URL tom_scimma-1.1.6-py3-none-any.whl
Size 24.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9974b2e0cf02e82a8c4dc929dedfbc0cd79c6457d7cefc3f70fe4ba1a9b7063a
BLAKE2b-256 checksum
How to use checksums
714c7f1caab0828ad62963c00650db0e94eb1363ce77297146500bdfeb0b1e51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release history Release notifications | RSS feed

This release

1.1.6 This release

2 release files

1.1.5

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page