Hi guys,
I am stuck at the same place as many people are/have been: the azure bing search and downloading images.
I have used this code (I believe from a user called Retuso):
def search_images_bing(key, term, max_images: int = 100, **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’])
I also changed the content_url to contentUrl:
results = search_images_bing(key, ‘grizzly bear’, min_sz=128)
ims = results.attrgot(‘contentUrl’)
However, when I go down to displaying the pictures, it says the variable does not have any inside.
fns = get_image_files(path)
fns(#0) []
Anyone can shed a bit of light? Hopefully this helps others in the same position as me as I haven’t yet found anyone with the same issues as me.
Many thanks!