Skip to main content

Helper classes for Jarvis applications

Project description

This package contains helper classes for open-jarvis applications.

Classes

Jarvis

This class is still in development

Jarvis(host, token, port=2021)
	.connect(reconnect_on_error=True)
	.reconnect()

	.set_property(key, value)	# TODO

Logger

Provides a uniform interface for logging files

Logger(logfile, compressed_folder)
	.on()	# turn on logging
	.off()	# turn off logging

	.console_on()	# turn on console logging
	.console_off()	# turn off console logging

	.new_group()	# turn on grouping and create a new logging group (only for fast RAM logging)
	.enable_fast()	# enable fast RAM logging
	.disable_fast()	# disable fast RAM logging
	.clear_fast()	# clear fast RAM logging data
	.get_fast()		# get fast RAM logs

	.i(tag, message)	# create an info message
	.e(tag, message)	# create an error message
	.w(tag, message)	# create a warning message
	.s(tag, message)	# create a success message
	.c(tag, message)	# create a critical message

MQTT

MQTT(host=127.0.0.1, port=1883, client_id=[random])
	.on_connect(callback[client, userdata, flags, rc])	# on connect event
	.on_message(callback[client, userdata, message])	# on message callback: topic = message.topic, data = message.payload.decode()
	.publish(topic, payload)	# public a str message under str topic
	.subscribe(topic)	# subscribe to a topic (# = all)

Colors

Colors
	.PURPLE = '\033[95m'
	.BLUE 	= '\033[94m'
	.CYAN 	= '\033[96m'
	.GREEN 	= '\033[92m'
	.YELLOW = '\033[93m'
	.RED 	= '\033[91m'
	.END 	= '\033[0m'
	.RESET	= '\033[0m'

	.WARNING= YELLOW
	.ERROR	= RED

SetupTools

SetupTools
	.do_action(print_str, shell_command, show_output=True, on_fail="failed!", on_success="done!", exit_on_fail=True):	# run a shell command
	.regex_replace_in_file(file_path, from_regex, to_string)	# replace regex in file
	.is_root()	# check if has root access
	.get_python_version()	# get the executing python version
	.check_python_version(version):	# make sure get_python_version() == version, exit on fail
	.check_root()	# make sure is_root() == True, exit on fail
	.get_default_installation_dir(default_dir)	# ask for the default Jarvis installation directory, return either default_dir or a new directory
	.get_default_user(default_user)	# ask for the default user, return either default_user or a new username

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

open-jarvis-0.0.16.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

open_jarvis-0.0.16-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file open-jarvis-0.0.16.tar.gz.

File metadata

  • Download URL: open-jarvis-0.0.16.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.3

File hashes

Hashes for open-jarvis-0.0.16.tar.gz
Algorithm Hash digest
SHA256 8e79559793b4c5feb92f7f6d24adc4184323e260cf143a9c5ab921209e8d8a05
MD5 9b0a2395a00fe55052bc00ff9efe60f0
BLAKE2b-256 5b143eb4923c60892d322bc5acb227a3274ca35389ebe99f07081f2f68afc5b8

See more details on using hashes here.

File details

Details for the file open_jarvis-0.0.16-py3-none-any.whl.

File metadata

  • Download URL: open_jarvis-0.0.16-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.3

File hashes

Hashes for open_jarvis-0.0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 f354e2df20e600586267cb3f6b15f0c253ddadcaaa5a27201f302c133a302efa
MD5 0f8e21c87c421a7067c05bb2481a8eab
BLAKE2b-256 db02e869761fafe3fd797f9d1e2310dcc07d9f749cb3f5c8d28dc42e8a184743

See more details on using hashes here.

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