當前位置: 首頁>>代碼示例>>Python>>正文


Python httplib2.RETRIES屬性代碼示例

本文整理匯總了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)) 
開發者ID:crhenr,項目名稱:youtube-video-maker,代碼行數:32,代碼來源:uploadrobot.py

示例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 
開發者ID:GoogleCloudPlatform,項目名稱:httplib2shim,代碼行數:30,代碼來源:httplib2_test.py


注:本文中的httplib2.RETRIES屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。