????3??Request???????

??????????case?????????request?????????????case??????????????????????????agent????????????е????case???????????????в????????????????????????

??????????????????????pylot?е??????????????????????request?У????????????

    def send(self?? req):
         # req is our own Request object
         if HTTP_DEBUG:
             opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookie_jar)?? urllib2.HTTPHandler(debuglevel=1))
         elif COOKIES_ENABLED:
             opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cookie_jar))
         else:
             opener = urllib2.build_opener()
         if req.method.upper() == 'POST':
             request = urllib2.Request(req.url?? req.body?? req.headers)
         else:
             request = urllib2.Request(req.url?? None?? req.headers)  # urllib2 assumes a GET if no data is supplied.  PUT and DELETE are not supported      
 
         # timed message send+receive (TTLB)
         req_start_time = self.default_timer()
         try:
             resp = opener.open(request)  # this sends the HTTP request and returns as soon as it is done connecting and sending
             connect_end_time = self.default_timer()
             content = resp.read()
             req_end_time = self.default_timer()
         except httplib.HTTPException?? e:  # this can happen on an incomplete read?? just catch all HTTPException
             connect_end_time = self.default_timer()
             resp = ErrorResponse()
             resp.code = 0
             resp.msg = str(e)
             resp.headers = {}
             content = ''
         except urllib2.HTTPError?? e:  # http responses with status >= 400
             connect_end_time = self.default_timer()
             resp = ErrorResponse()
             resp.code = e.code
             resp.msg = httplib.responses[e.code]  # constant dict of http error codes/reasons
             resp.headers = dict(e.info())
             content = ''
         except urllib2.URLError?? e:  # this also catches socket errors
             connect_end_time = self.default_timer()
             resp = ErrorResponse()
             resp.code = 0
             resp.msg = str(e.reason)
             resp.headers = {}  # headers are not available in the exception
             content = ''
         req_end_time = self.default_timer()
 
         if self.trace_logging:
             # log request/response messages
             self.log_http_msgs(req?? request?? resp?? content)           

         return (resp?? content?? req_start_time?? req_end_time?? connect_end_time)