Beispiel #1
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
Beispiel #2
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
Beispiel #3
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
Beispiel #4
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