A package to ease log sending to Statuscope
Project description
python-package
Source code of the Python package that is on PyPI
Install & Update
sudo pip3 install --upgrade statuscope
Example
Here is a sample use of the package.
import argparse
import time
import sys
import random
from statuscope.logger import Logger
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Sends logs to Statuscope.io')
parser.add_argument('-t',
'--token',
help='API token or task-specific token',
required=True)
parser.add_argument('-i',
'--task_id',
help='Task ID',
required=True)
args = parser.parse_args()
log_sender = Logger(args.token, args.task_id)
log_sender.start()
# We'll generate some silly log messages because test data is usually so boring
objects = [ 'plane', 'bike', 'book', 'icecream', 'dog' ]
colors = [ 'yellow', 'green', 'red', 'black', 'pink', 'white' ]
counter = 0
while True:
counter = counter + 1
try:
time.sleep(1)
log_sender.log("Log %s: I have a %s %s" % (counter, random.choice(colors), random.choice(objects)))
except KeyboardInterrupt:
print("Ctrl-C received, exiting...")
log_sender.flush()
try:
log_sender.join()
except Exception as e:
print(str(e))
sys.exit()
Then to update a log task,
python3 test.py --token cfa0d2ed --task_id QbZJjD2u3uzFvTYAM
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
statuscope-0.0.6.tar.gz
(3.1 kB
view details)
Built Distribution
File details
Details for the file statuscope-0.0.6.tar.gz
.
File metadata
- Download URL: statuscope-0.0.6.tar.gz
- Upload date:
- Size: 3.1 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.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9a169ae726b47e4c5880c12ba43c07a88f5dcbce221bf06174359b8dea70377 |
|
MD5 | 8833c5bbe8cab7727b03985f5cf12557 |
|
BLAKE2b-256 | d5d2510e1826f0992bc5192919c6c580e4f1885b494ff918a7370f77bf670c4c |
File details
Details for the file statuscope-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: statuscope-0.0.6-py3-none-any.whl
- Upload date:
- Size: 5.4 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.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ed26837b23ceab4c7e8bc38d8f69325ddeb00d51f2d634fdf773b33e85e9be8 |
|
MD5 | c1dcf01e3963ea0b3a261cfa86af278b |
|
BLAKE2b-256 | 981b01c3567968fa4e785c6721b997c1ade0114e816da88096e0a36fa17ffa7c |