Beispiel #1
0
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())
Beispiel #2
0
 def just(cls, value) -> 'ChainedAsyncObservable':
     return ChainedAsyncObservable(AsyncObservable.unit(value))
Beispiel #3
0
 async def mapper(value) -> AsyncObservable:
     fut = executor.submit(long_running, value)
     return AsyncObservable.unit(wrap_future(fut))