Skip to content

Commit 9cabecb

Browse files
Update utils.py (#620)
Microsoft updated 'Bing Image Search API' which created incompatibility with the search_images_bing() function. The issue is now resolved.
1 parent 5701d61 commit 9cabecb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ def get_image_files_sorted(path, recurse=True, folders=None): return get_image_f
3131
from msrest.authentication import CognitiveServicesCredentials as auth
3232

3333
def search_images_bing(key, term, min_sz=128, max_images=150):
34-
params = {'q':term, 'count':max_images, 'min_height':min_sz, 'min_width':min_sz}
34+
params = {'q':term, 'count':max_images, 'minHeight':min_sz, 'minWidth':min_sz, 'imageType':'photo'}
3535
headers = {"Ocp-Apim-Subscription-Key":key}
3636
search_url = "https://api.bing.microsoft.com/v7.0/images/search"
3737
response = requests.get(search_url, headers=headers, params=params)
3838
response.raise_for_status()
39-
search_results = response.json()
39+
search_results = response.json()
4040
return L(search_results['value'])
4141

4242

0 commit comments

Comments
 (0)