本文整理汇总了Python中httplib2.RETRIES属性的典型用法代码示例。如果您正苦于以下问题:Python httplib2.RETRIES属性的具体用法?Python httplib2.RETRIES怎么用?Python httplib2.RETRIES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类httplib2
的用法示例。
在下文中一共展示了httplib2.RETRIES属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import httplib2 [as 别名]
# 或者: from httplib2 import RETRIES [as 别名]
def __init__(self):
httplib2.RETRIES = 1
self.MAX_RETRIES = 10
self.RETRIABLE_EXCEPTIONS = (httplib2.HttpLib2Error, IOError, httplib.NotConnected,
httplib.IncompleteRead, httplib.ImproperConnectionState,
httplib.CannotSendRequest, httplib.CannotSendHeader,
httplib.ResponseNotReady, httplib.BadStatusLine)
self.RETRIABLE_STATUS_CODES = [500, 502, 503, 504]
self.CLIENT_SECRETS_FILE = "client_secrets.json"
self.YOUTUBE_UPLOAD_SCOPE = "https://www.googleapis.com/auth/youtube.upload"
self.YOUTUBE_API_SERVICE_NAME = "youtube"
self.YOUTUBE_API_VERSION = "v3"
self.MISSING_CLIENT_SECRETS_MESSAGE = """
WARNING: Please configure OAuth 2.0
To make this sample run you will need to populate the client_secrets.json file
found at:
%s
with information from the Developers Console
https://console.developers.google.com/
For more information about the client_secrets.json file format, please visit:
https://developers.google.com/api-client-library/python/guide/aaa_client_secrets
""" % os.path.abspath(os.path.join(os.path.dirname(__file__),
self.CLIENT_SECRETS_FILE))
示例2: testIPv6SSL
# 需要导入模块: import httplib2 [as 别名]
# 或者: from httplib2 import RETRIES [as 别名]
def testIPv6SSL(self):
try:
self.http.request("https://[::1]/")
except socket.gaierror:
self.fail("should get the address family right for IPv6")
except socket.error:
pass
# NOTE: Disabled because it's not applicable to the shim
# def testConnectionType(self):
# self.http.force_exception_to_status_code = False
# response, content = self.http.request(
# "http://bitworking.org", connection_type=_MyHTTPConnection)
# self.assertEqual(
# response['content-location'], "http://bitworking.org")
# self.assertEqual(content, b"the body")
# NOTE: Disabled because I don't yet have a good way to test this.
# def testBadStatusLineRetry(self):
# old_retries = httplib2.RETRIES
# httplib2.RETRIES = 1
# self.http.force_exception_to_status_code = False
# try:
# response, content = self.http.request("http://bitworking.org",
# connection_type=_MyHTTPBadStatusConnection)
# except http.client.BadStatusLine:
# self.assertEqual(2, _MyHTTPBadStatusConnection.num_calls)
# httplib2.RETRIES = old_retries