Skip to main content

super lightweight event loop

Project description

ssloop is a super simple eventloop

example:

import sys
import ssloop
import logging

logging.basicConfig(level=logging.DEBUG)

loop = ssloop.instance()


def on_connect(s):
    print 'on_connect'
    s.write('GET / HTTP/1.0\r\nHost: www.google.com\r\nConnection: Close\r\n\r\n')


def on_data(s, data):
    print 'on_data'
    sys.stdout.write(data)


def on_end(s):
    print 'on_end'


def on_close(s):
    print 'on_close'
    global loop
    loop.stop()


def on_error(s, e):
    print 'on_error'
    print e

s = ssloop.Socket()
s.on('connect', on_connect)
s.on('data', on_data)
s.on('end', on_end)
s.on('close', on_close)
s.on('error', on_error)
s.connect(('www.google.com', 80))

loop.start()

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

ssloop-0.0.4.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file ssloop-0.0.4.tar.gz.

File metadata

  • Download URL: ssloop-0.0.4.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ssloop-0.0.4.tar.gz
Algorithm Hash digest
SHA256 b4b610727ab40c5646c778557b55839376c23d3a824e4b65d9954eb5f0cb9da7
MD5 5e8767379e8efd76640321f0f765cdd4
BLAKE2b-256 368a1c59f216e0d43919ebcec15ca07195530a5c616f80f8cb0657caa4406e7f

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