tornado-retry-client

Simple retry tornado http client


Keywords
tornado, retry, client, backoff, python
License
MIT
Install
pip install tornado-retry-client==0.6.1

Documentation

Build Status PyPI version

Tornado Retry Client

Simple retry tornado http client that support exponential retries with backoff!

Install

with pip:

pip install tornado-retry-client

Usage

from tornado.httpclient import AsyncHTTPClient, HTTPError
from tornado_retry_client import http_retry

http_client = AsyncHTTPClient()

@gen.coroutine
def do_my_request()
    try:
        response = yield http_retry(http_client, 'http://globo.com', attempts=2)
    except HTTPError:
        pass # My request failed after 2 retries

# OR

from tornado_retry_client import RetryClient

retry_client = RetryClient(
    retry_attempts=3,
    retry_start_timeout=0.5,
    retry_max_timeout=10,
    retry_factor=2,
)

@gen.coroutine
def do_my_request()
    try:
        response = yield retry_client.fetch('http://globo.com')
    except HTTPError:
        pass # My request failed after 2 retries

Development

With empty virtualenv for this project, run this command:

make setup

and run all tests =)

make test

Contributing

Fork, patch, test, and send a pull request.