Skip to main content

Michael Corleone says ...

Project description

https://travis-ci.org/bninja/coid.png https://coveralls.io/repos/bninja/ciao/badge.png

Simple resource throttling. Get it:

$ pip install coid

use it e.g. like:

import datetime

import ciao
import sqlalchemy as sa

db_engine = sa.create_engine('postgres://mikey:corleone@localhost/study')

db_throttle = ciao.Throttle(
  duration=datetime.timedelta(seconds=30),
  exc=(
      sa.exc.OperationalError,
      sa.exc.DisconnectionError,
      sa.exc.InvalidRequestError,
      sa.exc.InterfaceError,
      sa.exc.DatabaseError,
      sa.exc.DBAPIError,
  ),
)

if not db_throttle:
   with db_throttle:
      db_engine.execute('SELECT * FROM slippers WHERE name = "mine"')

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 ciao, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size ciao-0.1.0.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page