Azure image search API not working

It appears that the search function have been changes since it’s not longer comming from utils and now is giving permission denied.

Once you’ve set key, you can use search_images_bing. This function is provided by the small utils class included with the notebooks online. If you’re not sure where a function is defined, you can just type it in your notebook to find out:

[24]

search_images_bing

1 frames
/usr/local/lib/python3.6/dist-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 = None**

ErrorResponseException: Operation returned an invalid status code 'PermissionDenied’

Hey, I think the problem is that the url for the api changed / something along those lines. I managed to solve it by doing what Zmey shows at the bottom of this post. 02_production PermissionDenied Error. I slightly modified his code to make it more like the original one offered by the book. The main difference between the two methods is how you obtain the image urls, since something changed and now the search_images_bing function doesn’t work, you manually do the request. Let me know if you need any help :slight_smile: