title: Urllib2 url open delay between opening webpage and getting html data
body: <p>I have a small python script that grabs some data from a webpage but the data on the webpage changes after a hit to the webpage. Is it possible to open the url wait a few seconds then return the data? My code is below I tried to add a few sleep commands but I doubt it is as simple as that.... any ideas?</p>
  
  <pre><code>url = "http://www.test.com"
          cj = cookielib.CookieJar()
          opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
          req = urllib2.Request(url)
          req.add_header('User-Agent','Mozilla/5.0')
  #       time.sleep(5)
          resp = opener.open(req)
  #       time.sleep(5)
          htmltext = resp.read()
  </code></pre>