def __init__(self, filename, autoconnect=True, policy=None):
     CookieJar.__init__(self, policy)
     if filename is not None and not isstringlike(filename):
         raise ValueError("filename must be string-like")
     self.filename = filename
     self._conn = None
     if autoconnect:
         self.connect()
 def __init__(self, filename, autoconnect=True, policy=None):
     experimental("Firefox3CookieJar is experimental code")
     CookieJar.__init__(self, policy)
     if filename is not None and not isstringlike(filename):
         raise ValueError("filename must be string-like")
     self.filename = filename
     self._conn = None
     if autoconnect:
         self.connect()
Ejemplo n.º 3
0
 def _request(self, url_or_req, data, visit,
              timeout=_sockettimeout._GLOBAL_DEFAULT_TIMEOUT):
     if isstringlike(url_or_req):
         req = Request(url_or_req, data, visit=visit, timeout=timeout)
     else:
         # already a mechanize.Request instance
         req = url_or_req
         if data is not None:
             req.add_data(data)
         # XXX yuck
         set_request_attr(req, "visit", visit, None)
         set_request_attr(req, "timeout", timeout,
                          _sockettimeout._GLOBAL_DEFAULT_TIMEOUT)
     return req
Ejemplo n.º 4
0
 def _request(self, url_or_req, data, visit,
              timeout=_sockettimeout._GLOBAL_DEFAULT_TIMEOUT):
     if isstringlike(url_or_req):
         req = Request(url_or_req, data, visit=visit, timeout=timeout)
     else:
         # already a urllib2.Request or mechanize.Request instance
         req = url_or_req
         if data is not None:
             req.add_data(data)
         # XXX yuck
         set_request_attr(req, "visit", visit, None)
         set_request_attr(req, "timeout", timeout,
                          _sockettimeout._GLOBAL_DEFAULT_TIMEOUT)
     return req
Ejemplo n.º 5
0
 def _request(self, url_or_req, data, visit):
     if isstringlike(url_or_req):
         req = Request(url_or_req, data, visit=visit)
     else:
         # already a urllib2.Request or mechanize.Request instance
         req = url_or_req
         if data is not None:
             req.add_data(data)
         # XXX yuck, give request a .visit attribute if it doesn't have one
         try:
             req.visit
         except AttributeError:
             req.visit = None
         if visit is not None:
             req.visit = visit
     return req
Ejemplo n.º 6
0
 def _request(self, url_or_req, data, visit):
     if isstringlike(url_or_req):
         req = Request(url_or_req, data, visit=visit)
     else:
         # already a urllib2.Request or mechanize.Request instance
         req = url_or_req
         if data is not None:
             req.add_data(data)
         # XXX yuck, give request a .visit attribute if it doesn't have one
         try:
             req.visit
         except AttributeError:
             req.visit = None
         if visit is not None:
             req.visit = visit
     return req