title: Download images from IPFS
body: <p>I have a nice set of URLs saved in this format</p>
  <pre><code>Number  Link
  0   https://ipfs.io/ipfs/QmRRPWG96cmgTn2qSzjwr2qvfNEuhunv6FNeMFGa9bx6mQ
  1   https://ipfs.io/ipfs/QmPbxeGcXhYQQNgsC6a36dDyYUcHgMLnGKnF8pVFmGsvqi
  2   https://ipfs.io/ipfs/QmcJYkCKK7QPmYWjp4FD2e3Lv5WCGFuHNUByvGKBaytif4
  3   https://ipfs.io/ipfs/QmYxT4LnK8sqLupjbS6eRvu1si7Ly2wFQAqFebxhWntcf6
  4   https://ipfs.io/ipfs/QmSg9bPzW9anFYc3wWU5KnvymwkxQTpmqcRSfYj7UmiBa7
  5   https://ipfs.io/ipfs/QmNwbd7ctEhGpVkP8nZvBBQfiNeFKRdxftJAxxEdkUKLcQ
  6   https://ipfs.io/ipfs/QmWBgfBhyVmHNhBfEQ7p1P4Mpn7pm5b8KgSab2caELnTuV
  7   https://ipfs.io/ipfs/QmRsJLrg27GQ1ZWyrXZFuJFdU5bapfzsyBfm3CAX1V1bw6
  </code></pre>
  <p>I am trying  to use a loop to loop through all of the links and save the file</p>
  <pre><code>import urllib.request
  
  for x,y in zip(link, num):
      url = str(x)
      name = str(y)
      filename = &quot;%s.png&quot; % name   
      urllib.request.urlretrieve(url, filename)
  </code></pre>
  <p>Everytime I run this code I get this error</p>
  <pre><code>URLError: &lt;urlopen error [WinError 10054] An existing connection was forcibly closed by the remote host&gt;
  </code></pre>
  <p>What is weird is that if I just run the code on one URL then it works fine.</p>
  <pre><code>import urllib.request
  
  name = 1
  filename = &quot;%s.png&quot; % name   
  urllib.request.urlretrieve(&quot;https://ipfs.io/ipfs/QmcJYkCKK7QPmYWjp4FD2e3Lv5WCGFuHNUByvGKBaytif4&quot;, filename)
  </code></pre>
  <p>How can this be fixed so that the code runs in a loop with no errors?</p>
  <p>thanks</p>
  <p><strong>EDIT</strong></p>
  <p>Here is some code that works for 1 image</p>
  <pre><code>import pandas as pd 
  import urllib.request
  
  links = [['number', 'link'], ['1', 'https://ipfs.io/ipfs/QmPbxeGcXhYQQNgsC6a36dDyYUcHgMLnGKnF8pVFmGsvqi'], ['2', 'https://ipfs.io/ipfs/QmcJYkCKK7QPmYWjp4FD2e3Lv5WCGFuHNUByvGKBaytif4'], ['3', 'https://ipfs.io/ipfs/QmYxT4LnK8sqLupjbS6eRvu1si7Ly2wFQAqFebxhWntcf6']]
  data = pd.DataFrame(links)
  
  link = data.get('Link', None) 
  num = data.get('Number', None)
  
  
  name = 1
  filename = &quot;%s.png&quot; % name   
  urllib.request.urlretrieve(&quot;https://ipfs.io/ipfs/QmYxT4LnK8sqLupjbS6eRvu1si7Ly2wFQAqFebxhWntcf6&quot;, filename)
  </code></pre>