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
from statuscope.logger import LoggerConfig
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()
# Create a logger configuration object and enable logs
log_config = LoggerConfig()
log_config.enable_logs()
# Set the component that these logs belong to
# Note that this is a global setting and it can be overridden on each (debug|info|warning|error|alert) call
log_config.set_component('test')
log_sender = Logger(args.token, args.task_id, log_config)
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' ]
components = [ 'auth', 'backend', 'frontend', 'db', 'payment' ]
severities = [ 'debug', 'info', 'warning', 'error', 'alert' ]
counter = 0
while True:
counter = counter + 1
try:
time.sleep(1)
severity = random.choice(severities)
component = random.choice(components)
color = random.choice(colors)
object = random.choice(objects)
if severity == 'debug':
log_sender.debug("Log %s: I have a %s %s" % (counter, color, object), component)
elif severity == 'info':
log_sender.info("Log %s: I have a %s %s" % (counter, color, object), component)
elif severity == 'warning':
log_sender.warn("Log %s: I have a %s %s" % (counter, color, object), component)
elif severity == 'error':
log_sender.error("Log %s: I have a %s %s" % (counter, color, object), component)
elif severity == 'alert':
log_sender.alert("Log %s: I have a %s %s" % (counter, color, object), component)
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
Metadata
Release files for statuscope 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| statuscope-0.1.1.tar.gz | 4.3 kB | Without provenance | Details for statuscope-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| statuscope-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for statuscope-0.1.1-py3-none-any.whl |
Total release size: 9.7 kB
Release files / statuscope-0.1.1.tar.gz
| Download URL | statuscope-0.1.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e93450608288d4f74e2d7635dcb78507d9a37936738e26c909e0faed7abad756
|
|
BLAKE2b-256 checksum How to use checksums |
ea6941fd96b5dba11b61bb10791d5e30a2ac032a97d1639c5ec2d22032180570
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / statuscope-0.1.1-py3-none-any.whl
| Download URL | statuscope-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
463bd712ea78da8f2cc33b023a55a8e763e194eec5ba35cb0bb4b50127437594
|
|
BLAKE2b-256 checksum How to use checksums |
523f686781d7df70c6ecf020c1dd0b1651016cf5b3474559a86365a2b16718c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Security for statuscope 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.