google-custom-search library#
Submodules#
google_custom_search.search module#
- class google_custom_search.search.CustomSearch(apikey: str, engine_id: str, image: Optional[bool] = False)#
Bases:
object
This is the class used when using Google Custom Search.
- Parameters
apikey (str) – Insert google custom search api key.
engine_id (str) – Insert google custom search engine id.
- APIURL = 'https://www.googleapis.com/customsearch/v1'#
- search(keyword: str) List[Item] #
This is searched using api.
- Parameters
keyword (str) – Search word
- Returns
return result
- Return type
List[Item]
- Raises
ApiNotEnabled – api is not invalid
- async search_async(keyword: str) List[Item] #
This is an asynchronous version of custom_search.search.
- Parameters
keyword (str) – Search word
- Returns
return result
- Return type
List[Item]
- Raises
ApiNotEnabled – api is not invalid
AsyncError – If you don’t install aiohttp, lib call error.
Note
You need aiohttp library.
google_custom_search.types module#
- class google_custom_search.types.Item(data: dict)#
Bases:
object
This is return a item.
- property display_url: str#
This is the display url of the item.
- property html_title: str#
This is the html title of the item.
- property kind: str#
This is the kind of the item.
- property snippet: str#
This is the snippet of the item.
- property title: str#
This is the title of the item.
- property url: str#
This is the url of the item.
google_custom_search.errors module#
- exception google_custom_search.errors.ApiNotEnabled(code: str, error: str)#
Bases:
Exception
- exception google_custom_search.errors.AsyncError#
Bases:
Exception