How to handle exceptions properly in a pythonic way?
John Gordon
gordon at panix.com
Mon Nov 2 15:05:36 EST 2015
In <4b303213-62e2-42d4-b2f6-4fc1f6025944 at googlegroups.com> zljubisic at gmail.com writes:
> Let's say that I have the following simple function:
> def get_html(url):
> wpage = requests.get(url)
>
> return wpage.text
> How to handle exceptions properly that can arise during execution of the
> requests.get(url)?
The best way is probably to do nothing at all, and let the caller handle
any exceptions.
--
John Gordon A is for Amy, who fell down the stairs
gordon at panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
More information about the Python-list
mailing list