How to use unsync - 6 common examples

To help you get started, we’ve selected a few unsync examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Wintellect / WintellectWebinars / 2019-01-24-async-python-kennedy / code / the_unsync / thesync.py View on Github external
@unsync()
async def download_some():
    print("Downloading...")
    url = 'https://talkpython.fm/episodes/show/174/coming-into-python-from-another-industry-part-2'
    async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:
        async with session.get(url) as resp:
            resp.raise_for_status()

            text = await resp.text()

    print("Downloaded (more) {:,} characters.".format(len(text)))
github talkpython / async-techniques-python-course / src / 09-built-on-asyncio / the_unsync / thesync.py View on Github external
@unsync(cpu_bound=True)
def compute_some():
    print("Computing...")
    for _ in range(1, 10_000_000):
        math.sqrt(25 ** 25 + .01)
github talkpython / async-techniques-python-course / src / 09-built-on-asyncio / the_unsync / thesync.py View on Github external
@unsync()
async def download_some():
    print("Downloading...")
    url = 'https://talkpython.fm/episodes/show/174/coming-into-python-from-another-industry-part-2'
    async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:
        async with session.get(url) as resp:
            resp.raise_for_status()

            text = await resp.text()

    print("Downloaded (more) {:,} characters.".format(len(text)))
github talkpython / async-techniques-python-course / src / 09-built-on-asyncio / the_unsync / thesync.py View on Github external
@unsync()
def download_some_more():
    print("Downloading more ...")
    url = 'https://pythonbytes.fm/episodes/show/92/will-your-python-be-compiled'
    resp = requests.get(url)
    resp.raise_for_status()

    text = resp.text

    print("Downloaded {:,} characters.".format(len(text)))
github Wintellect / WintellectWebinars / 2019-01-24-async-python-kennedy / code / the_unsync / thesync.py View on Github external
@unsync(cpu_bound=True)
def compute_some():
    print("Computing...")
    for _ in range(1, 10_000_000):
        math.sqrt(25 ** 25 + .01)
github Wintellect / WintellectWebinars / 2019-01-24-async-python-kennedy / code / the_unsync / thesync.py View on Github external
@unsync()
def download_some_more():
    print("Downloading more ...")
    url = 'https://pythonbytes.fm/episodes/show/92/will-your-python-be-compiled'
    resp = requests.get(url)
    resp.raise_for_status()

    text = resp.text

    print("Downloaded {:,} characters.".format(len(text)))

unsync

Unsynchronize asyncio

MIT
Latest version published 1 year ago

Package Health Score

59 / 100
Full package analysis

Popular unsync functions

Similar packages