Synchronus Wrapper for Async Code
Project description
Run fast asynchronous code from a synchronous code. Async Services provide a synchronous wrapper to run third party asynchronous code or any coroutine for that matter in a synchronous way from a synchronous code.
Installation :
pip install async_services
Example Usage: from async_services.core import run_coro
async def coroutine(seconds=1, raise_exception=False): await asyncio.sleep(seconds) if raise_exception: raise Exception("Sample Exception") return "Hello World"
result = run_coro(coroutine(), block=True) print(result) assert result[0] == CoroStatus.Completed assert result[1] == "Hello World"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for async_services-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2130b7eb20e03d94434260f3a9da2c306fab24dc778c641529fa3cfa2940b4f1 |
|
MD5 | 5bbf1946925ffe7c68d276a07b89bba9 |
|
BLAKE2b-256 | 6e22e65df4815bb2e5e0a58c75416687af34808aa584b86b122d6fd400503d2c |