Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Catch gaierror in Django / Python?

Tags:

python

django

How do I properly catch a gaierror in Django or Python? This error is brought up when a request to a 3rd party API is made and no connection can be made. I tried a try with an empty except but the gaierror was not caught.

Advice? Thanks!

like image 457
rabbid Avatar asked Apr 18 '26 21:04

rabbid


1 Answers

I've seen some rumbling in some websearches about using urllib and urllib2 to catch these errors. Maybe something in this question may help you.

like image 152
j_syk Avatar answered Apr 21 '26 09:04

j_syk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!