TOM工具箱的Skip/Hopskotch代理模块

tom-scimma的Python项目详细描述


Coverage Status

汤姆西玛

此模块添加HopskotchSkip 对TOM工具箱的支持。使用此模块,TOMs可以查询提交到Hopskotch流的警报,并将警报发布到Hopskotch。在

安装

将模块安装到您的TOM环境中:

pip install tom-scimma

tom_scimma.scimma.SCIMMABroker添加到汤姆的settings.py中的TOM_ALERT_CLASSES

^{pr2}$

虽然跳过警报是公开的(目前),但您需要Hopskotch凭据才能提交警报。你可以注册 帐户here。添加适当的Skip和Hopskotch 项目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':''}}

可配置设置

url:跳过请求的URL,即检索警报的URL。在

api_key:用于使用Skip进行身份验证/授权的API密钥。当前未使用。在

hopskotch_url:Hopskotch代理提交的URL,即提交警报。在

hopskotch_username:用于验证Hopskotch的用户名。在

hopskotch_password:用于验证Hopskotch的密码。在

default_hopskotch_topic:未提供警报时提交警报的Hopskotch主题。在

可用的templatetags

尽管TOM工具箱提供了一个代理提交模板标签,tom_scimma提供了一个额外的templatetag 包含主题的关键字参数。使用它

tom_scimma添加到您的settings.INSTALLED_APPS

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

然后,将scimma_extras添加到所需模板的{% load ... %}语句中:

    {% load bootstrap4 targets_extras ... scimma_extras %}

最后,将所需的templatetag添加到模板中需要的位置:

    {% submit_upstream_scimma_form target observation_record redirect_url topic_name %}

submit_upstream_to_scimma按钮的签名和docstring如下:

```
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
    """
```

运行测试

要运行测试,请在virtualenv中运行以下命令:

python tom_scimma/tests/run_tests.py

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java将json反序列化为列表<Object>   Spring框架中的java回滚机制   java如何使反射在JDK 16及更高版本上工作?   java终结器如何导致可移植性问题?   java Hibernate使用ON子句或alternative左连接获取   java aws codebuild maven项目失败“保存的引用不明确”   并发Java多线程读取单个大文件   java如果输入仅由1和0组成,请将其从二进制转换为十进制   java在RealmRecyServiceAdapter上调用updateData实际上并没有更新数据   javajsf:h commandlink操作是打开同一页面的新弹出窗口,而不是调用bean方法   java我们可以为其中一个变量同时添加@Column和@OneToOne注释吗?   java JBoss AS 7自定义登录模块从未调用   如何检查Java中是否存在数组中的元素   java Spring重试:未调用带@Recover注释的方法   如何解析带有Java错误HTTP格式问题的php消息   java如何在weblogic中部署可选的包共享库   java将配置单元中的数据集保存为avro格式的合并列   用Guice注入java泛型   java单选按钮组和额外选项   javajackson:如何读取字符串作为列表?