Esempio n. 1
0
 def http_response(self, request, response):
     if not hasattr(response, "seek"):
         response = response_seek_wrapper(response)
     info = getLogger("ClientCookie.http_responses").info
     try:
         info(response.read())
     finally:
         response.seek(0)
     info("*****************************************************")
     return response
 def http_response(self, request, response):
     if not hasattr(response, "seek"):
         response = response_seek_wrapper(response)
     info = getLogger("ClientCookie.http_responses").info
     try:
         info(response.read())
     finally:
         response.seek(0)
     info("*****************************************************")
     return response
Esempio n. 3
0
Copyright 2002-2006 John J Lee <*****@*****.**>
Copyright 1997-1999 Gisle Aas (original libwww-perl code)

This code is free software; you can redistribute it and/or modify it
under the terms of the BSD or ZPL 2.1 licenses (see the file
COPYING.txt included with the distribution).

"""

import time, re, string
from _ClientCookie import reraise_unmasked_exceptions, FileCookieJar, Cookie, \
     MISSING_FILENAME_TEXT, LoadError
from _HeadersUtil import join_header_words, split_header_words
from _Util import startswith, iso2time, time2isoz
from _Debug import getLogger
debug = getLogger("ClientCookie").debug

try: True
except NameError:
    True = 1
    False = 0

def lwp_cookie_str(cookie):
    """Return string representation of Cookie in an the LWP cookie file format.

    Actually, the format is extended a bit -- see module docstring.

    """
    h = [(cookie.name, cookie.value),
         ("path", cookie.path),
         ("domain", cookie.domain)]
Esempio n. 4
0
Copyright 2002-2004 John J Lee <*****@*****.**>

This code is free software; you can redistribute it and/or modify it under
the terms of the BSD License (see the file COPYING included with the
distribution).

"""

import copy, time, tempfile

import ClientCookie
from _ClientCookie import CookieJar, request_host
from _Util import isstringlike, startswith, getheaders
from _Debug import getLogger
info = getLogger("ClientCookie").info

try: True
except NameError:
    True = 1
    False = 0


CHUNK = 1024  # size of chunks fed to HTML HEAD parser, in bytes

try:
    from urllib2 import AbstractHTTPHandler
except ImportError:
    pass
else:
    import urlparse, urllib2, urllib, httplib
Esempio n. 5
0
 def http_request(self, request):
     if hasattr(request, "redirect_dict"):
         info = getLogger("ClientCookie.http_redirects").info
         info("redirecting to %s", request.get_full_url())
     return request
Esempio n. 6
0
Copyright 2002-2006 John J Lee <*****@*****.**>

This code is free software; you can redistribute it and/or modify it
under the terms of the BSD or ZPL 2.1 licenses (see the file
COPYING.txt included with the distribution).

"""

import copy, time, tempfile, htmlentitydefs, re

import ClientCookie
from _ClientCookie import CookieJar, request_host
from _Util import isstringlike, startswith, getheaders, closeable_response
from _HeadersUtil import is_html
from _Debug import getLogger
debug = getLogger("ClientCookie.cookies").debug

try: True
except NameError:
    True = 1
    False = 0


CHUNK = 1024  # size of chunks fed to HTML HEAD parser, in bytes
DEFAULT_ENCODING = 'latin-1'

try:
    from urllib2 import AbstractHTTPHandler
except ImportError:
    pass
else:
 def http_request(self, request):
     if hasattr(request, "redirect_dict"):
         info = getLogger("ClientCookie.http_redirects").info
         info("redirecting to %s", request.get_full_url())
     return request
Copyright 2002-2006 John J Lee <*****@*****.**>

This code is free software; you can redistribute it and/or modify it
under the terms of the BSD or ZPL 2.1 licenses (see the file
COPYING.txt included with the distribution).

"""

import copy, time, tempfile, htmlentitydefs, re

import ClientCookie
from _ClientCookie import CookieJar, request_host
from _Util import isstringlike, startswith, getheaders, closeable_response
from _HeadersUtil import is_html
from _Debug import getLogger
debug = getLogger("ClientCookie.cookies").debug

try:
    True
except NameError:
    True = 1
    False = 0

CHUNK = 1024  # size of chunks fed to HTML HEAD parser, in bytes
DEFAULT_ENCODING = 'latin-1'

try:
    from urllib2 import AbstractHTTPHandler
except ImportError:
    pass
else:
Esempio n. 9
0
Copyright 2002-2004 John J Lee <*****@*****.**>

This code is free software; you can redistribute it and/or modify it under
the terms of the BSD License (see the file COPYING included with the
distribution).

"""

import copy, time, tempfile

import ClientCookie
from _ClientCookie import CookieJar, request_host
from _Util import isstringlike, startswith, getheaders
from _Debug import getLogger

info = getLogger("ClientCookie").info

try:
    True
except NameError:
    True = 1
    False = 0

CHUNK = 1024  # size of chunks fed to HTML HEAD parser, in bytes

try:
    from urllib2 import AbstractHTTPHandler
except ImportError:
    pass
else:
    import urlparse, urllib2, urllib, httplib