title: How do I get urllib library to download all the files with .gz extension from one http directory
body: <p>I have tried to get urllib to download all the files that end with .gz within a directory. My code runs without error but does not download anything. I am not exactly sure what I am doing wrong here. Please help me.</p>
  
  <pre><code>from urllib import *
  directory = 'https://eogdata.mines.edu/wwwdata/viirs_products/vnf/v30'
  with request.urlopen(directory) as doc:
          for line in doc:  
              if line.endswith(b'gz'):
                  urllib.request.retrieve(line)
  </code></pre>