async def search_wikipedia(term): """Search Wikipedia for a given term""" url = "http://en.wikipedia.org/w/api.php" params = {"action": "opensearch", "search": term, "format": "json"} async with aiohttp.ClientSession() as session: async with session.get(url, params=params) as resp: return AsyncObservable.unit(await resp.text())
def just(cls, value) -> 'ChainedAsyncObservable': return ChainedAsyncObservable(AsyncObservable.unit(value))
async def mapper(value) -> AsyncObservable: fut = executor.submit(long_running, value) return AsyncObservable.unit(wrap_future(fut))