Skip to main content

NATS wrapper for fast scanner development

Project description

.. image:: https://travis-ci.com/hardenchant/nats_scan_wrapper.svg?token=oEYn8ZVFWCpj1fwzyy2Q&branch=master :target: https://travis-ci.com/hardenchant/nats_scan_wrapper :alt: Build status for the master branch

.. image:: https://img.shields.io/pypi/v/bordercontrol.svg :target: https://pypi.org/project/bordercontrol/ :alt: Latest version on PyPi


Instruction for develop a new module.

.. code-block:: python

from bc.dev.handlers import WorkerThreadHandler

counter = 0

def worker_function(data):
    global counter
    counter += 1
    print(counter)

    return {"results": [1, 2, 3, 45]}

a = WorkerThreadHandler(worker_function=worker_function, name='name', hostname='hostname')
a.run()

worker_function - required arg

name - optional

hostname - optional

data - here you see all data which send in sheduler in your channel, e.g.:

.. code-block:: json

{
   "_id":"5c4f3c5e1a169100074132ca",
   "pipeline":[
        "tgchecker"
   ],
   "crontab":"* * * * *",
   "payload":{
        "integram_url": "",
        "text": ""
   },
   "active": false,
   "trigger_timestamp": 1548696730,
   "full_pipeline":[
        "tgchecker"
   ]
}

{"results": [1, 2, 3, 45]} - module send to channel _reporter as:

.. code-block:: python

{
    'task_data': data,
    'result': [1, 2, 3, 45],
    'name': 'name',
    'hostname': 'hostname'
}

Module send to channel _registration:

.. code-block:: json

{
    "name": "name",
    "hostname": "hostname"
}

Module must receive from channel _registration:

.. code-block:: python

{
    'subjects_to_subscribe': ['test'],
    'unique_name': 'test_module1'
}

If error will be detected in worker, module send error message to channel _errors:

.. code-block:: python

{
    'task_data': data,
    'result': "ERROR",
    'name': 'name',
    'hostname': 'hostname'
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bordercontrol-0.2.0.0.5.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bordercontrol-0.2.0.0.5-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file bordercontrol-0.2.0.0.5.tar.gz.

File metadata

  • Download URL: bordercontrol-0.2.0.0.5.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.6

File hashes

Hashes for bordercontrol-0.2.0.0.5.tar.gz
Algorithm Hash digest
SHA256 fc84753baa101513b4f2bfa6e28d19c38fde8ece024eea558ecab2610044c87d
MD5 5d3641d8a3ee9362a50901893e749bcd
BLAKE2b-256 84e41a3fd946ffd001f109150bfd2e6207bdd6a8d9b6f7d350bd810fbf1184a5

See more details on using hashes here.

File details

Details for the file bordercontrol-0.2.0.0.5-py3-none-any.whl.

File metadata

  • Download URL: bordercontrol-0.2.0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.6

File hashes

Hashes for bordercontrol-0.2.0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d5bb9517c8533a8a076fca5fa0f46c72465188585c332a9ff9aed32f47877b01
MD5 823cdaf037ebbac0a472b4635f112fb6
BLAKE2b-256 26494eaf3af275fef8ab9af6873e7d58013eaf054146ab22c77aa21815930060

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page