Skip to content

Commit

Permalink
Update utils.py (#620)
Browse files Browse the repository at this point in the history
Microsoft updated 'Bing Image Search API' which created incompatibility with the search_images_bing() function. The issue is now resolved.
  • Loading branch information
DarshitSolanki04 authored Jul 7, 2024
1 parent 5701d61 commit 9cabecb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ def get_image_files_sorted(path, recurse=True, folders=None): return get_image_f
from msrest.authentication import CognitiveServicesCredentials as auth

def search_images_bing(key, term, min_sz=128, max_images=150):
params = {'q':term, 'count':max_images, 'min_height':min_sz, 'min_width':min_sz}
params = {'q':term, 'count':max_images, 'minHeight':min_sz, 'minWidth':min_sz, 'imageType':'photo'}
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()
search_results = response.json()
return L(search_results['value'])


Expand Down

0 comments on commit 9cabecb

Please # to comment.