I have this code
#!/usr/bin/python
import grequests
urls = [
'http://google.com',
'http://doesnotexists.tld'
]
def do_something(response, **kwargs):
print response.text
async_list = []
for u in urls:
action_item = grequests.get(u, timeout=10, hooks = {'response' : do_something})
async_list.append(action_item)
grequests.map(async_list,size=10)
How do I handle errors without getting usual Python error messages?
For example for domain which does not exists it prints out "not found".
try: grequests.map(async_list,size=10) except ConnectionError as e: print e
print e
withpass
)