Skip to content

Commit

Permalink
Added ability to set the timeout value
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkingserious committed Feb 8, 2016
1 parent a5de16e commit 31bd04f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sendgrid/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(self, apikey, **opts):
self.host = opts.get('host', 'https://api.sendgrid.com')
# urllib cannot connect to SSL servers using proxies
self.proxies = opts.get('proxies', None)
self.timeout = opts.get('timeout', 10)

self.apikeys = APIKeys(self)
self.asm_groups = ASMGroups(self)
Expand Down Expand Up @@ -66,7 +67,7 @@ def _build_request(self, url, json_header=False, method='GET', data=None):
if data:
response = urllib_request.urlopen(req, json.dumps(data))
else:
response = urllib_request.urlopen(req, timeout=10)
response = urllib_request.urlopen(req, timeout=self.timeout)
except HTTPError as e:
if 400 <= e.code < 500:
raise SendGridClientError(e.code, e.read())
Expand Down

0 comments on commit 31bd04f

Please sign in to comment.