gnosticdev commited on
Commit
3f4048a
·
verified ·
1 Parent(s): ef907a1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -16
app.py CHANGED
@@ -81,22 +81,22 @@ def search_google_images(query, num_images=1):
81
  "key": api_key
82
  }
83
  ).json()
84
- else:
85
- with requests_proxy.ProxyManager(proxies) as proxy_manager:
86
- result = proxy_manager.get(
87
- f"https://www.googleapis.com/customsearch/v1",
88
- params={
89
- "q": query,
90
- "cx": cse_id,
91
- "searchType": "image",
92
- "num": num_images * 3,
93
- "safe": 'off',
94
- "imgSize": 'HUGE',
95
- "imgType": 'photo',
96
- "rights": 'cc_publicdomain|cc_attribute|cc_sharealike',
97
- "key": api_key
98
- }
99
- ).json()
100
 
101
  if 'items' in result:
102
  image_urls = []
 
81
  "key": api_key
82
  }
83
  ).json()
84
+ else:
85
+ with requests_proxy.ProxyManager(proxies) as proxy_manager:
86
+ result = proxy_manager.get(
87
+ f"https://www.googleapis.com/customsearch/v1",
88
+ params={
89
+ "q": query,
90
+ "cx": cse_id,
91
+ "searchType": "image",
92
+ "num": num_images * 3,
93
+ "safe": 'off',
94
+ "imgSize": 'HUGE',
95
+ "imgType": 'photo',
96
+ "rights": 'cc_publicdomain|cc_attribute|cc_sharealike',
97
+ "key": api_key
98
+ }
99
+ ).json()
100
 
101
  if 'items' in result:
102
  image_urls = []