Exceptions cause your application to crash. Handling them allows you to recover gracefully and keep your application running. Learn how to handle exceptions, find what exceptions you should be handling, and exit gracefully in this lesson. You will also learn how you should not handle exceptions and when it is better to let your application crash rather than swallowing an exception.
How do you catch an exception from the requests.exceptions "ReadTimeout" ? Can you please show me a quick example?
How do you catch an exception from the requests.exceptions "ReadTimeout" ? Can you please show me a quick example?
try:
r = requests.get(url, params={'s': thing})
except requests.exceptions.RequestException as e: # This is the correct syntax
print e
sys.exit(1)