https://github.com/wpjunior/tornado-retry-client
Simple retry tornado http client
https://github.com/wpjunior/tornado-retry-client
backoff python retry tornado
Last synced: 7 months ago
JSON representation
Simple retry tornado http client
- Host: GitHub
- URL: https://github.com/wpjunior/tornado-retry-client
- Owner: wpjunior
- License: mit
- Created: 2015-05-04T18:23:12.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2019-08-27T21:34:41.000Z (almost 7 years ago)
- Last Synced: 2025-02-01T14:51:10.344Z (over 1 year ago)
- Topics: backoff, python, retry, tornado
- Language: Python
- Size: 36.1 KB
- Stars: 8
- Watchers: 4
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](http://travis-ci.org/wpjunior/tornado-retry-client)
[](https://badge.fury.io/py/tornado-retry-client)
# Tornado Retry Client
Simple retry tornado http client that support [exponential retries with backoff](http://dthain.blogspot.com/2009/02/exponential-backoff-in-distributed.html)!
## Install
with pip:
```bash
pip install tornado-retry-client
```
## Usage
```python
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:
```bash
make setup
```
and run all tests =)
```bash
make test
```
## Contributing
Fork, patch, test, and send a pull request.