mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Added an extra layer of exception handling to image retrieval.
This commit is contained in:
@@ -21,7 +21,10 @@ class DuckDuckGo:
|
||||
query = query.string
|
||||
except AttributeError:
|
||||
query = query
|
||||
search_result = requests.get(self.url + query + _key)
|
||||
try:
|
||||
search_result = requests.get(self.url + query + _key)
|
||||
except Error as e:
|
||||
return False
|
||||
try:
|
||||
image_result = search_result.json()["Image"]
|
||||
except ValueError:
|
||||
|
||||
Reference in New Issue
Block a user