From 4482db591bc7ac61c6cb7fa89e0c3ea337d58926 Mon Sep 17 00:00:00 2001 From: Josh Owen Date: Wed, 27 Aug 2014 17:40:05 -0400 Subject: [PATCH] more efficient error code checking --- sendgrid/sendgrid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sendgrid/sendgrid.py b/sendgrid/sendgrid.py index e71bbfa12..5310415af 100644 --- a/sendgrid/sendgrid.py +++ b/sendgrid/sendgrid.py @@ -109,9 +109,9 @@ def _raising_send(self, message): try: return self._make_request(message) except HTTPError as e: - if e.code in range(400, 500): + if 400 <= e.code < 500: raise SendGridClientError(e.code, e.read()) - elif e.code in range(500, 600): + elif 500 <= e.code < 600: raise SendGridServerError(e.code, e.read()) else: assert False