Skip to main content

No project description provided

Project description



<body>
<header>
<address>body scan</address>
</header>

<main>
<address>quick start</address>

<p>How to start checks</p>
<code python3>

import body_scan
import pathlib

scan = body_scan.start (
glob_string = pathlib.Path (__file__).parent.resolve () + '/**/*HEALTH.py',
simultaneous = True,
relative_path = pathlib.Path (__file__).parent.resolve ()
)
</code>

<b>body_scan.start options</b>
<code>

#
# REQUIRED
# This is all the files that are sent to the scanner.
#
glob_string = search + '/**/*HEALTH.py',

#
# This runs all the checks in a thread pool,
# so maybe at the same time, more or less.
#
# If False, then checks are run one at a time
#
simultaneous = True,

#
# OPTIONAL
# These are the folders that are added to "sys.path"
#
module_paths = [
normpath (join (search, "modules_pip"))
],

#
# OPTIONAL
# This is the folder path to remove from the paths in the output.
#
relative_path = search

</code>

<b>How to write checks</b>
<code python3>
def check_1 ():
print ("check 1")

def check_2 ():
raise Exception ("NOT 100%")


CHECKS = {
"check 1": check_1,
"check 2": check_2
}
</code>


<b>output</b>

output is printed in 3 sections:
status:
empty = true -> no "checks" were found
parsed = true -> the python3 exec compiler could parse the file

alarms
stats

<code python3>
status: {
"paths": [
{
"path": "guarantee_1.py",
"empty": false,
"parsed": true,
"stats": {
"passes": 1,
"alarms": 1
},
"checks": [
{
"check": "check 1",
"passed": true,
"elapsed": [
1.07790001493413e-05,
"SECONDS"
]
},
{
"check": "check 2",
"passed": false,
"exception": "Exception('NOT 100%')",
"exception trace": [
"Traceback (most recent call last):",
" File \"/body_scan/processes/scan/keg/scan.py\", line 68, in scan",
" checks [ check ] ()",
" File \"<string>\", line 10, in check_2",
"Exception: NOT 100%"
]
}
]
}
],
"stats": {
"alarms": 0,
"empty": 0,
"checks": {
"passes": 1,
"alarms": 1
}
}
}
alarms: [
{
"path": "guarantee_1.py",
"checks": [
{
"check": "check 2",
"passed": false,
"exception": "Exception('NOT 100%')",
"exception trace": [
"Traceback (most recent call last):",
" File \"/body_scan/structure/modules/body_scan/processes/scan/keg/scan.py\", line 68, in scan",
" checks [ check ] ()",
" File \"<string>\", line 10, in check_2",
"Exception: NOT 100%"
]
}
]
}
]
stats: {
"alarms": 0,
"empty": 0,
"checks": {
"passes": 1,
"alarms": 1
}
}
</code>
</main>
</body>

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

body_scan-0.1.4.tar.gz (7.1 kB view hashes)

Uploaded Source

Supported by

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