Skip to content
Permalink
Browse files

Merge pull request #220 from rctay/rc/191-ssl-gae

googleapiclient.http: guard when importing ssl.
  • Loading branch information...
nathanielmanistaatgoogle committed Apr 28, 2016
2 parents 133b9ff + 3146c92 commit 6d9ba5164f46738a06a3696c4c088089c5064664
Showing with 9 additions and 2 deletions.
  1. +9 −2 googleapiclient/http.py
@@ -38,11 +38,18 @@
import os
import random
import socket
import ssl
import sys
import time
import uuid

# TODO(issue 221): Remove this conditional import jibbajabba.
try:
import ssl
except ImportError:
_ssl_SSLError = object()
else:
_ssl_SSLError = ssl.SSLError

from email.generator import Generator
from email.mime.multipart import MIMEMultipart
from email.mime.nonmultipart import MIMENonMultipart
@@ -146,7 +153,7 @@ def _retry_request(http, num_retries, req_type, sleep, rand, uri, method, *args,
exception = None
resp, content = http.request(uri, method, *args, **kwargs)
# Retry on SSL errors and socket timeout errors.
except ssl.SSLError as ssl_error:
except _ssl_SSLError as ssl_error:
exception = ssl_error
except socket.error as socket_error:
# errno's contents differ by platform, so we have to match by name.

0 comments on commit 6d9ba51

Please sign in to comment.
You can’t perform that action at this time.