{ } Raw JSON

bundles / papyri 0.0.10 / papyri / examples / async_fetch

function

papyri.examples:async_fetch

source: /papyri/examples.py :517

Signature

async def   async_fetch ( url : str * timeout : float = 10.0 )  →  bytes

Summary

Pretend to fetch url and return its body.

Extended Summary

A minimal async def coroutine function used to exercise papyri's handling of coroutine function signatures. The body does no I/O so the example stays side-effect free at import time.

Of course timeout does nothing

Parameters

url : str

Target URL. The value is ignored in this example.

timeout : float, keyword-only, optional

Deadline in seconds. Defaults to 10.0.

Returns

: bytes

A fixed, deterministic response body.

See also

async_counter

An async def generator function (has yield).

example1

Another async example, with a more elaborate signature.

simple_generator

The synchronous generator counterpart.

Aliases

  • papyri.examples.async_fetch