Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Bram Daams
sch
Commits
ae96b9ad
Commit
ae96b9ad
authored
Jan 20, 2020
by
Bram Daams
Browse files
regel korter en extra newline
parent
9a612733
Pipeline
#36631
passed with stage
in 35 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
ae96b9ad
venv
test.py
crnnr.egg-info
__pycache__
SmartCronHelper.egg-info/
README.md
View file @
ae96b9ad
...
...
@@ -12,24 +12,34 @@ $ pip install .
## Test
For now, create a file
`test.py`
```
python
"""
Testing hc.py
"""
from
crontabs
import
CronTabs
from
hc
import
HealthcheckCredentials
,
Healthchecks
cred
=
HealthcheckCredentials
(
api_url
=
'https://hc.example.com/api/v1/'
,
api_key
=
'mysecretapikey'
)
api_url
=
'https://hc.example.com/api/v1/'
,
api_key
=
'mysecretapikey'
)
CRED
=
HealthcheckCredentials
(
api_url
=
'https://cronmon.science.ru.nl/api/v1/'
,
api_key
=
'AbuQXRDCqBk_Q9SiPRfmJA2KtvbNWKx4'
)
h
=
Healthchecks
(
cred
)
h
.
P
rint
S
tatus
()
H
=
Healthchecks
(
CRED
)
H
.
p
rint
_s
tatus
()
jobs
=
CronTabs
().
all
.
find_command
(
'JOB_ID'
)
for
job
in
jobs
:
check
=
h
.
find_check
(
job
)
JOBS
=
CronTabs
().
all
.
find_command
(
'JOB_ID'
)
for
job
in
JOBS
:
check
=
H
.
find_check
(
job
)
if
check
:
h
.
update_check
(
check
,
job
)
H
.
update_check
(
check
,
job
)
else
:
h
.
new_check
(
job
)
H
.
new_check
(
job
)
```
And run it within the virtual environment
...
...
hc.py
View file @
ae96b9ad
...
...
@@ -12,7 +12,11 @@ import click
import
requests
import
tzlocal
HealthcheckCredentials
=
collections
.
namedtuple
(
'HealthcheckCredentials'
,
'api_url api_key'
)
HealthcheckCredentials
=
collections
.
namedtuple
(
'HealthcheckCredentials'
,
'api_url api_key'
)
class
Healthchecks
:
"""
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment