Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Aio core utils

Project Description


Core definitions and utilities for the aio asyncio framework


Install with:

pip install aio.core

aio.core.exceptions usage


>>> from configparser import ConfigParser
>>> from aio.core.exceptions import MissingConfiguration
>>> def get_configuration(conf, section, option):
...     try:
...         conf[section][option]
...     except KeyError:
...         raise MissingConfiguration(
...             "Configuration option is missing: %s:%s" % (
...                 section, option))
>>> try:
...     get_configuration(ConfigParser(), "foo", "bar")
... except MissingConfiguration as e:
...     print(e)
Configuration option is missing: foo:bar


>>> from aio.core.exceptions import BadConfiguration
>>> def get_configuration(conf, section, option, option_type):
...     option_value = conf[section][option]
...     try:
...         option_type(option_value)
...     except ValueError:
...         raise BadConfiguration(
...             'Configuration is bad: %s:%s expected type %s, but got "%s"' % (
...                 section, option, option_type.__name__, option_value))
>>> config = ConfigParser()
>>> config.read_dict({"foo": {"bar": "baz"}})
>>> try:
...     get_configuration(config, "foo", "bar", int)
... except BadConfiguration as e:
...     print(e)
Configuration is bad: foo:bar expected type int, but got "baz"


>>> from aio.core.exceptions import CommandError
>>> def run_command(command):
...     options = ["egg", "chips"]
...     if command not in options:
...         raise CommandError("This command cannot be called with %s" % command)
>>> try:
...     run_command("spam")
... except CommandError as e:
...     print(e)
This command cannot be called with spam
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
aio.core-0.1.0.tar.gz (2.7 kB) Copy SHA256 Checksum SHA256 Source May 24, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting