Python http 模块,cookiejar() 实例源码

我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用http.cookiejar()

项目:lib9    作者:Jumpscale    | 项目源码 | 文件源码
def logout(self):
        if not hasattr(self, "basicAuth") or not hasattr(self, "cookiejar"):
            return

        if self.basicAuth or not self.cookiejar:
            return

        # check our cookie and logout if needed
        for cookie in self.cookiejar:
            if cookie.name == "auth":
                # this following part is just mimicking the webui
                cookieIndex = ord(cookie.value[0]) - ord("a")
                self.setAttribute("M1", 40038, chr(cookieIndex), 0)

                # remove the cookie from our jar
                self.cookiejar.clear(cookie.domain, cookie.path, cookie.name)
                break
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def __init__(self, cookiejar=None):
        import http.cookiejar
        if cookiejar is None:
            cookiejar = http.cookiejar.CookieJar()
        self.cookiejar = cookiejar
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def http_request(self, request):
        self.cookiejar.add_cookie_header(request)
        return request
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def http_response(self, request, response):
        self.cookiejar.extract_cookies(response, request)
        return response
项目:packaging    作者:blockstack    | 项目源码 | 文件源码
def test_other_http_imports(self):
        import http
        import http.server
        import http.cookies
        import http.cookiejar
        self.assertTrue(True)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def __init__(self, cookiejar=None):
        import http.cookiejar
        if cookiejar is None:
            cookiejar = http.cookiejar.CookieJar()
        self.cookiejar = cookiejar
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def http_request(self, request):
        self.cookiejar.add_cookie_header(request)
        return request
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def http_response(self, request, response):
        self.cookiejar.extract_cookies(response, request)
        return response
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def __init__(self, cookiejar=None):
        import http.cookiejar
        if cookiejar is None:
            cookiejar = http.cookiejar.CookieJar()
        self.cookiejar = cookiejar
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def http_request(self, request):
        self.cookiejar.add_cookie_header(request)
        return request
项目:kbe_server    作者:xiaohaoppy    | 项目源码 | 文件源码
def http_response(self, request, response):
        self.cookiejar.extract_cookies(response, request)
        return response
项目:packaging    作者:blockstack    | 项目源码 | 文件源码
def test_future_moves(self):
        """
        Ensure everything is available from the future.moves interface that we
        claim and expect. (Issue #104).
        """
        from future.moves.collections import Counter, OrderedDict   # backported to Py2.6
        from future.moves.collections import UserDict, UserList, UserString

        from future.moves import configparser
        from future.moves import copyreg

        from future.moves.itertools import filterfalse, zip_longest

        from future.moves import html
        import future.moves.html.entities
        import future.moves.html.parser

        from future.moves import http
        import future.moves.http.client
        import future.moves.http.cookies
        import future.moves.http.cookiejar
        import future.moves.http.server

        from future.moves import queue

        from future.moves import socketserver

        from future.moves.subprocess import check_output              # even on Py2.6
        from future.moves.subprocess import getoutput, getstatusoutput

        from future.moves.sys import intern

        from future.moves import urllib
        import future.moves.urllib.error
        import future.moves.urllib.parse
        import future.moves.urllib.request
        import future.moves.urllib.response
        import future.moves.urllib.robotparser

        try:
            # Is _winreg available on Py2? If so, ensure future.moves._winreg is available too:
            import _winreg
        except ImportError:
            pass
        else:
            from future.moves import winreg

        from future.moves import xmlrpc
        import future.moves.xmlrpc.client
        import future.moves.xmlrpc.server

        from future.moves import _dummy_thread
        from future.moves import _markupbase
        from future.moves import _thread