Bing search key and 'PermissionDenied' error

Hi folks,

So it looks like things have been changed by Microsoft since this course began and some of the things on Lesson 2 no longer work/are not the same anymore. It took me a while to figure out and the information is scattered so I thought it might be useful to do a single post with the info, that might save some time to the other folks (at least until it breaks again).

First to get your key:
Make an azure account - https://azure.microsoft.com/en-us/free/cognitive-services/
You will need a phone number and a credit card

Follow these steps to create a bing resource - https://docs.microsoft.com/en-us/bing/search-apis/bing-web-search/create-bing-search-service-resource

After that you should be able to see your keys here:

Now unfortunately is not over yet, seems like Microsoft is restructuring their services and the URL changed:

I’ve created an issue on the fastbook github since I have no idea on how to update and test the libraries on the jupyter notebooks:

But luckily someone has implemented a workaround here:

So follow the steps to do a local definition of search_images_bing and that should do it. The official microsoft docs are here as well:


Note: Another issue I had was while running
dest = ‘images/grizzly.jpg’
download_url(ims[0], dest)

–> 167 with open(dest, ‘wb’) as f:
168 nbytes = 0
169 if show_progress: pbar = progress_bar(range(file_size), leave=False, parent=pbar)

FileNotFoundError: [Errno 2] No such file or directory: ‘images/grizzly.jpg’

On the clean directory there is no images folder, so simply create one from the terminal or from python. (open terminal, cd fastbook, cd clean , mkdir images)

Hope this helps!

4 Likes

Thanks for posting it!

Additionally, we might want to comment out the line

#hide
ims = ['http://3.bp.blogspot.com/-S1scRCkI3vY/UHzV2kucsPI/AAAAAAAAA-k/YQ5UzHEm9Ss/s1600/Grizzly%2BBear%2BWildlife.jpg']

As it replaces everything we downloaded before

2 Likes