Skip to main content

socket server for bot communication

Project description

Secure socket communication via botnet

>>> pip install botsocket

Default settings are valid only for localhost testing. Based on Command Bus design pattern.

myserver.py

import os
from botsocket.server import start_server
from mycommands import *

if __name__ == '__main__':
  # uncomment for production
  # os.environ['BOTSOCKET_SETTINGS_MODULE'] = 'settings.py'
  start_server()

mycommands.py

from botsocket.commandbus import Command, CommandHandler

class MyCommand(Command):
  def __init__(self, msg):
    self.msg = msg

class MyCommandHandler(CommandHandler):
  def handle(self, command):
      return command.msg

myclient.py

import os
from botsocket.client import send_command
from mycommands import MyCommand

if __name__ == '__main__':
  # uncomment for production
  # os.environ['BOTSOCKET_SETTINGS_MODULE'] = 'settings.py'
  cmd = MyCommand('yo')
  result = send_command(cmd)

Notes for production:

  • create settings.py and make sure it has same variables as in botsocket.default_settings.py;
  • create self-signed certificate cert.pem;
  • create logging.yml;
  • import all commands in myserver.py in order to unpickle command’s objects.

Project details


Download files

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

Files for botsocket, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size botsocket-0.1.tar.gz (4.3 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