From 8efc2c71b04d09e6aa03e34c785ef69ef923678e Mon Sep 17 00:00:00 2001 From: tgehrs Date: Mon, 11 Jan 2016 14:13:48 -0500 Subject: [PATCH 1/2] change timeout --- sendgrid/sendgrid.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sendgrid/sendgrid.py b/sendgrid/sendgrid.py index d222f2a9a..84323fd02 100644 --- a/sendgrid/sendgrid.py +++ b/sendgrid/sendgrid.py @@ -51,6 +51,7 @@ def __init__(self, username_or_apikey, password=None, **opts): self.endpoint = opts.get('endpoint', '/api/mail.send.json') self.mail_url = self.host + ':' + self.port + self.endpoint self._raise_errors = opts.get('raise_errors', False) + self.timeout = opts.get('timeout', 10) # urllib cannot connect to SSL servers using proxies self.proxies = opts.get('proxies', None) @@ -109,7 +110,7 @@ def _make_request(self, message): # Using API key req.add_header('Authorization', 'Bearer ' + self.password) - response = urllib_request.urlopen(req, timeout=10) + response = urllib_request.urlopen(req, self.timeout) body = response.read() return response.getcode(), body From fa81103cb02e67a95501777b4087c92bed6bb150 Mon Sep 17 00:00:00 2001 From: tgehrs Date: Tue, 12 Jan 2016 16:56:23 -0500 Subject: [PATCH 2/2] change timeout to opts --- sendgrid/sendgrid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sendgrid/sendgrid.py b/sendgrid/sendgrid.py index 84323fd02..dd08d23cb 100644 --- a/sendgrid/sendgrid.py +++ b/sendgrid/sendgrid.py @@ -110,7 +110,7 @@ def _make_request(self, message): # Using API key req.add_header('Authorization', 'Bearer ' + self.password) - response = urllib_request.urlopen(req, self.timeout) + response = urllib_request.urlopen(req, timeout = self.timeout) body = response.read() return response.getcode(), body