I’m getting the PermissionDenied Error, too, and even Bing Search APIs v7 doesn’t help.
I think the issue is that Microsoft has changed the service from “Cognitive” to “Bing Services”, something along the lines. This started on 1/11/20.
Probably in the utils.py file the API url needs to be changed from https://api.cognitive.microsoft.com to https://api.bing.microsoft.com/v7.0/images/search? @jeremy
I tried change, but I got error: Operation returned an invalid status code ‘Resource Not Found’ and I have problem with PermissionDenied. I can’t solve it.
I don’t think Access Denied is the same as Permission Denied, need more info posted on what you are doing.
Edit
As the response code from the request is not actually seen in the stack trace it would need to be found using debug. A fault is anything other than the code 200
Searching through the response codes at HTTP Response Codes there are no direct matchings for ‘PermissionDenied’ and ‘Access Denied’. They are perhaps AZURE specific. A search of the AZURE python code in
~/anaconda/envs/fastai/lib/python3.7/azure
maybe fruitful.
Other than that take the advise given by the other posters in this post.
I believe Jeremy did not intend for AZURE to be the definitive image search but was left with it as a compromise. Also AZURE interface may be changed at any time, so expect new behaviour to occur.
It maybe that one relates to a good key value and some other security issue, or else a bad key and then a direct failure.
This solves the Permission Denied error by building on Zmey56’s solution.
I created a local instance of the bing search function, that returns an L object.
I have been having the same issue although I changed it in the utils.py file that is installed in my notebook. Still the same issue.
It appears though it is calling another the file from following path which I cannot find to alter the code:
/opt/conda/envs/fastai/lib/python3.8/site-packages/fastbook/init.py
Nah apparently not the utils.py file from the jupyter nb is taken but another one you cannot change.
I recommend implementing retuso’s solution in a cell in your notebook!
I can confirm this works wonderfully and I’m grateful for the solution.
(In my case, I preferred to give this function a new name, not overwrite the initial one.)
Also, it’s very easy to forget to change content_url to contentUrl, this might first thing to look at if errors.
These instructions no longer work - the Bing images search is no longer in Cognitive Services - the new endpoint is https://api.bing.microsoft.com/ . I got the key by going to BingImages > Keys and Endpoint but can’t get it to work with the Fast Ai api; I get a Permission Denied error. When I try out the key using example code from Microsoft I don’t get an error.
Hi,
thanks very much for your code, works really well. I am trying to learn more about you L object, but I cant find ‘L Object’ anywhere in the python documentation. Would you be able to point me in the right direction?
Thanks for your hl