def play(self, call_func=None, pre_func=None, post_func=None):
    r_tmp = self.copy()
    if conf.update_content_length:
      r_tmp.remove_header("Content-Length")
    fdreq, freqname = tempfile.mkstemp(suffix=".http")
    fdrep, frepname = tempfile.mkstemp(suffix=".http")
    with os.fdopen(fdreq, 'w') as f:
      f.write(str(r_tmp))
    if self.response:
      with os.fdopen(fdrep, 'w') as f:
        f.write(str(self.response))
    last_access = os.stat(freqname).st_mtime
    ret = subprocess.Popen(shlex.split(conf.play_start.format(freqname,frepname)))
    r_new = None
    while ret.poll() != 0:
      if os.stat(freqname).st_mtime != last_access:
        play_notifier("Reading request...")
        freq = open(freqname, 'r')
        try:
          r_new = Request(freq, self.hostname, self.port, self.use_ssl)
          if r_new.method in ('POST', 'PUT') and conf.update_content_length:
            play_notifier("Updating Content Length...")
            r_new.update_content_length()
          freq.close()
          if pre_func:
            play_notifier("Calling pre_func...")
            r_new = pre_func(r_new)
          if call_func:
            play_notifier("Calling call_func...")
            call_func(r_new)
          else:
            play_notifier("Connecting...")
            c = r_new._init_connection()
            play_notifier("Sending request...")
            r_new(conn=c, complete=False)
            play_notifier("Reading response...")
            r_new._read_response(c, None)
          if post_func:
            play_notifier("Calling post_func...")
            res_text = post_func(r_new.response)
          else:
            res_text = r_new.response
          if res_text:
            frep = open(frepname, 'w')
            frep.write(str(res_text))
            frep.close()
          play_notifier("Time: " + str(r_new.response.time.total_seconds()))
          play_updater()
        except Exception, e:
          play_notifier("Exception: " + str(e))
        last_access = os.stat(freqname).st_mtime
      # hack to avoid 100% CPU usage. Should be replaced by pyinotify.
      time.sleep(0.1)
    os.remove(freqname)
    os.remove(frepname)
    return r_new
Calculate an area difference.
dataset/ETHPy150Open tweksteen/burst/burst/http.py/Request.play--crossover with--dataset/ETHPy150Open googlei18n/nototools/nototools/shape_diff.py/ShapeDiffFinder._calc_diff