parameters: (url, filename)
return_statement: return filename
docstring: Download the contents of url to filename, return filename.
docstring_summary: Download the contents of url to filename, return filename.
docstring_tokens: Download the contents of url to filename return filename .
function: def httpget(url, filename):
      """Download the contents of url to filename, return filename."""
      print "Fetching %s to %s." % (url, filename)
      conn = None
      u=urlparse.urlparse(url)
      assert(u.scheme=='http')
      try:
          h = httplib2.Http(cache = os.environ["HOME"] + "/.cache")
          resp, content = h.request(url, "GET")
          t=filename+'.TMP'
          if resp.status==200:
              with open(t, 'w') as f:
                  f.write(content)
          else:
              raise Exception("HTTP error %d" % resp.status)
          os.rename(t, filename)
      finally:
          if conn:
              conn.close()
      return filename
function_tokens: def httpget ( url , filename ) : print "Fetching %s to %s." % ( url , filename ) conn = None u = urlparse . urlparse ( url ) assert ( u . scheme == 'http' ) try : h = httplib2 . Http ( cache = os . environ [ "HOME" ] + "/.cache" ) resp , content = h . request ( url , "GET" ) t = filename + '.TMP' if resp . status == 200 : with open ( t , 'w' ) as f : f . write ( content ) else : raise Exception ( "HTTP error %d" % resp . status ) os . rename ( t , filename ) finally : if conn : conn . close ( ) return filename