Skip to main content

OBJ is a package that provides an object class that can save/load objects in JSON format.

Project description

OBJ is a pure python package that provides an object class that can save/load objects in JSON format to disk, thus providing persistence to objects. Files are saved with a timestamp in their filename, so that searching in a time related manner becomes possible.

OBJ has a “no-clause MIT license” that should be the most liberal license you can get at the year 2018.

source code is available with:

hg clone http://bitbucket.org/bthate/obj

OBJ is on pypi, see https://pypi.org/project/obj

you can install it with:

pip3 install obj

configuration

to edit config options use the ed command:

obj ed obj.shell.Cfg channel \#obbot
ok channel="#obbot"

commands

OB shell has the following commands:

cfg            - show config files.
cmds           - show list of commands.
deleted        - show deleted records.
ed             - edit saved json objects.
exit           - stop the program.
find           - find objects in the datastore.
fleet          - show list of registered bots.
kill           - stop a thread.
last           - show last record of a object type.
load           - load a module.
log            - log some text.
ls             - list subdirectories in the workdir.
ps             - show running threads.
reboot         - reboot the bot.
rm             - set the deleted flag on an object.
test           - echo test response.
todo           - store a todo item.
unload         - unload a module.
uptime         - show uptime.
version        - show OB version.

programming

Programming your own commands is easy, your can load your own module with the -m option. A command is a function with one argument, the event that was generated on the bot.

def mycommand(event):

    <<< your code here >>>

You can use event.reply() to send response back to the user.

modules

The following modules can be loaded from the ob package space:

base           - the base module containing the Object class providing load/save to JSON functionality.
cli            - the command line interface bot giving access to the bot from the shell.
cmds           - commands subpackage containing the above listed commands.
db             - database functionality that can search through objects stored on disk.
event          - the Event class generated on bots when data is read from the socket.
fleet          - list of registered bots managed in the Fleet class.
handler        - the event handler of the bot.
loader         - Loader class to load modules from ob space into the program.
shell          - shell related startup, cli arguments parsing and logging.
thr            - thread module to launch, kill threads.

Project details


Release history Release notifications

This version

65

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for obj, version 65
Filename, size File type Python version Upload date Hashes
Filename, size obj-65.tar.gz (15.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page