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


Python http_cookiejar.CookieJar方法代碼示例

本文整理匯總了Python中six.moves.http_cookiejar.CookieJar方法的典型用法代碼示例。如果您正苦於以下問題:Python http_cookiejar.CookieJar方法的具體用法?Python http_cookiejar.CookieJar怎麽用?Python http_cookiejar.CookieJar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在six.moves.http_cookiejar的用法示例。


在下文中一共展示了http_cookiejar.CookieJar方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from six.moves import http_cookiejar [as 別名]
# 或者: from six.moves.http_cookiejar import CookieJar [as 別名]
def __init__(self, configuration, debug=True):
        super(XMLAPIConnector, self).__init__()
        self.storage_ip = enas_utils.convert_ipv6_format_if_needed(
            configuration.emc_nas_server)
        self.username = configuration.emc_nas_login
        self.password = configuration.emc_nas_password
        self.debug = debug
        self.auth_url = 'https://' + self.storage_ip + '/Login'
        self._url = 'https://{}/servlets/CelerraManagementServices'.format(
            self.storage_ip)
        context = enas_utils.create_ssl_context(configuration)
        if context:
            https_handler = url_request.HTTPSHandler(context=context)
        else:
            https_handler = url_request.HTTPSHandler()
        cookie_handler = url_request.HTTPCookieProcessor(
            http_cookiejar.CookieJar())
        self.url_opener = url_request.build_opener(https_handler,
                                                   cookie_handler)
        self._do_setup() 
開發者ID:openstack,項目名稱:manila,代碼行數:22,代碼來源:connector.py

示例2: __init__

# 需要導入模塊: from six.moves import http_cookiejar [as 別名]
# 或者: from six.moves.http_cookiejar import CookieJar [as 別名]
def __init__(self, app, extra_environ=None, relative_to=None,
                 use_unicode=True, cookiejar=None, parser_features=None,
                 json_encoder=None, lint=True):
        if 'WEBTEST_TARGET_URL' in os.environ:
            app = os.environ['WEBTEST_TARGET_URL']
        if isinstance(app, string_types):
            if app.startswith('http'):
                try:
                    from wsgiproxy import HostProxy
                except ImportError:  # pragma: no cover
                    raise ImportError((
                        'Using webtest with a real url requires WSGIProxy2. '
                        'Please install it with: '
                        'pip install WSGIProxy2'))
                if '#' not in app:
                    app += '#httplib'
                url, client = app.split('#', 1)
                app = HostProxy(url, client=client)
            else:
                from paste.deploy import loadapp
                # @@: Should pick up relative_to from calling module's
                # __file__
                app = loadapp(app, relative_to=relative_to)
        self.app = app
        self.lint = lint
        self.relative_to = relative_to
        if extra_environ is None:
            extra_environ = {}
        self.extra_environ = extra_environ
        self.use_unicode = use_unicode
        self.cookiejar = cookiejar or http_cookiejar.CookieJar(
            policy=CookiePolicy())
        if parser_features is None:
            parser_features = 'html.parser'
        self.RequestClass.ResponseClass.parser_features = parser_features
        if json_encoder is None:
            json_encoder = json.JSONEncoder
        self.JSONEncoder = json_encoder 
開發者ID:MayOneUS,項目名稱:pledgeservice,代碼行數:40,代碼來源:app.py

示例3: cookies

# 需要導入模塊: from six.moves import http_cookiejar [as 別名]
# 或者: from six.moves.http_cookiejar import CookieJar [as 別名]
def cookies(self):
    """CookieJar object that will be used for cookies in this request."""
    if self._cookies is None:
      self._cookies = cookielib.CookieJar()
    return self._cookies 
開發者ID:luci,項目名稱:luci-py,代碼行數:7,代碼來源:net.py


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