Created
December 5, 2020 10:57
-
-
Save jacKlinc/1eb757852c70ca4611d62331f96d8213 to your computer and use it in GitHub Desktop.
Bing Image Search Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def search_images_bing(key, term, max_images: int = 150, **kwargs): | |
params = {'q':term, 'count':max_images} | |
headers = {"Ocp-Apim-Subscription-Key":key} | |
search_url = "https://api.bing.microsoft.com/v7.0/images/search" | |
response = requests.get(search_url, headers=headers, params=params) | |
response.raise_for_status() | |
search_results = response.json() | |
return L(search_results['value']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment