Welcome to async_stagger’s documentation!
Project home page: https://github.com/twisteroidambassador/async_stagger
Check out the project’s README file for the elevator pitch.
Quick Start
Installation
Install through PyPI as usual:
pip install async-stagger
Python 3.6 or above is required.
Making TCP connections using Happy Eyeballs
To quickly get the benefit of Happy Eyeballs, simply use
async_stagger.create_connection()
and
async_stagger.open_connection()
where you would use their asyncio
counterparts. Modifications required are minimal, since they support all the
usual arguments except sock, and all new arguments are optional and have
sane defaults.
Alternatively, use async_stagger.create_connected_sock()
to create a
connected socket.socket
object, and use it as you wish.
Using the underlying scheduling logic
The Happy Eyeballs scheduling logic, i.e. “run coroutines with staggered start
times, wait for one to complete, cancel all others”, is exposed in a reusable
form in async_stagger.staggered_race()
.