Skip to content

TennisBowling/asyncbing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AsyncBing

asyncbing is an asyncio api wrapper for the Bing Search Api. It uses a modern async/await python api.
Docs

Installing

python -m pip install asyncbing
For the stable version of asyncbing.
python -m pip install git+https://github.com/TennisBowling/asyncbing/
For the unstable/cutting edge of asyncbing. Not recommended in production.

Usage

Get a Bing Search Api key guide
Then replace the key you have with 'key' in the examples

Sample usage

Searching

import asyncbing
import asyncio

async def main():
    async with asyncbing.search('key') as s:
        resp = await s.fetch('cool search term')
        print(resp.matches)
        oneresult = resp.getOne()
        print(oneresult.name)
        print(oneresult.url)
        print(oneresult.snippet)

asyncio.run(main())

Translating

import asyncbing
import asyncio

async def main():
    async with asyncbing.translate('key', region='useast') as t:
        resp = await t.translate('je veux traduire')
        print(resp.detected_language)
        print(resp.translated_output)
        print(resp.translated_language)

asyncio.run(main())