key = ‘XXX’
search_images_bing
results = search_images_bing(key, ‘grizzly bear’)
ims = results.attrgot(‘content_url’)
len(ims)
ErrorResponseException Traceback (most recent call last)
in
----> 1 results = search_images_bing(key, ‘grizzly bear’)
2 ims = results.attrgot(‘content_url’)
3 len(ims)~/fastai-2020/fastai2/course-v4/nbs/utils.py in search_images_bing(key, term, min_sz)
31 def search_images_bing(key, term, min_sz=128):
32 client = api(‘https://api.cognitive.microsoft.com’, auth(key))
—> 33 return L(client.images.search(query=term, count=150, min_height=min_sz, min_width=min_sz).value)
34
35~/anaconda3/envs/fastai2/lib/python3.7/site-packages/azure/cognitiveservices/search/imagesearch/operations/_images_operations.py in search(self, query, accept_language, user_agent, client_id, client_ip, location, aspect, color, country_code, count, freshness, height, id, image_content, image_type, license, market, max_file_size, max_height, max_width, min_file_size, min_height, min_width, offset, safe_search, size, set_lang, width, custom_headers, raw, **operation_config)
489
490 if response.status_code not in [200]:
–> 491 raise models.ErrorResponseException(self._deserialize, response)
492
493 deserialized = NoneErrorResponseException: Operation returned an invalid status code ‘PermissionDenied’