Package: ratchet
pyratchet is a generic library for reporting exceptions and other messages toRatchet.io:import ratchet, sys
ratchet.init('YOUR_ACCESS_TOKEN', 'production')  # access_token, environment

try:
    main_app_loop()
except IOError:
    ratchet.report_message('Got an IOError in the main loop', 'warning')
except:
    # catch-all
    ratchet.report_exc_info(sys.exc_info())Requirementspyratchet requires:Python 2.6 or 2.7requests 0.12+a Ratchet.io accountInstallationInstall using pip:pip install ratchetConfigurationFor generic Python or a non-Django/non-Pyramid framework, follow these instructions:Somewhere in your initialization code, call ratchet.init() with your access_token:ratchet.init('YOUR_ACCESS_TOKEN_HERE', environment='production')Other options can be passed as keyword arguments. See the reference below for all options.If you are integrating with Django, follow these instructions:In yoursettings.py, add'ratchet.contrib.django.middleware.RatchetNotifierMiddleware'as the last item inMIDDLEWARE_CLASSES:MIDDLEWARE_CLASSES = (
    # ... other middleware classes ...
    'ratchet.contrib.django.middleware.RatchetNotifierMiddleware',
)Add these configuration variables insettings.py:RATCHET = {
    'access_token': 'YOUR_ACCESS_TOKEN_HERE',
    'environment': 'development' if DEBUG else 'production',
    'branch': 'master',
    'root': '/absolute/path/to/code/root',
}If you are integrating with Pyramid, follow these instructions:In yourinifile (e.g.production.ini), addratchet.contrib.pyramidto the end of yourpyramid.includes:[app:main]
pyramid.includes =
    pyramid_debugtoolbar
    ratchet.contrib.pyramidAdd these ratchet configuration variables:[app:main]
ratchet.access_token = YOUR_ACCESS_TOKEN_HERE
ratchet.environment = production
ratchet.branch = master
ratchet.root = %(here)sThe above will configure ratchet to catch and report all exceptions that occur in your Pyramid app. However, if there are any middleware
applications that wrap your app, Ratchet will not be able to catch exceptions.In order to catch exceptions from Pyramid and middleware code, you will need to create apipelinewhere the ratchet middleware wraps your Pyramid app.Change yourinifile to use apipeline:From

[app:main]
...

To

[pipeline:main]
pipeline =
    ratchet
    YOUR_APP_NAME

[app:YOUR_APP_NAME]
pyramid.includes =
    pyramid_debugtoolbar
    ratchet.contrib.pyramid

[filter:ratchet]
access_token = YOUR_ACCESS_TOKEN_HERE
environment = production
branch = master
root = %(here)sUnfortunately, the ratchet tween and the ratchet filter configurations contains duplicated information. We’ll look into fixing this in future versions.UsageThe Django and Pyramid integration will automatically report uncaught exceptions to Ratchet.Callratchet.report_exc_info()to report an exception, orratchet.report_message()to report an arbitrary string message. See the docstrings for more info.Configuration referenceaccess_tokenAccess token from your Ratchet.io projecthandlerOne of:blocking – runs in main threadthread – spawns a new threadagent – writes messages to a log file for consumption by ratchet-agentdefault:threadenvironmentEnvironment name. Any string up to 255 chars is OK. For best results, use “production” for your production environment.rootAbsolute path to the root of your application, not including the final/.branchName of the checked-out branch.default:masteragent.log_fileIfhandlerisagent, the path to the log file. Filename must end in.ratchetendpointURL items are posted to.default:https://submit.ratchet.io/api/1/item/scrub_fieldsList of field names to scrub out of POST. Values will be replaced with astrickses. If overridiing, make sure to list all fields you want to scrub, not just fields you want to add to the default. Param names are converted to lowercase before comparing against the scrub list.default['passwd', 'password', 'secret', 'confirm_password', 'password_confirmation']Developer ResourcesGet in touch! We’d love to hear what you think and we’re happy to help.Email us:support@ratchet.ioIRC:#ratchet.ioonirc.freenode.netWant to contribute? Send a pull request athttps://github.com/ratchetio/pyratchet