title: Beautifulsoup download all .zip files from Google Patent Search
body: <p>What I am trying to do is use Beautifulsoup to download every zip file from the Google Patent archive. Below is the code that i've written thus far. But it seems that I am having troubles getting the files to download into a directory on my desktop. Any help would be greatly appreciated </p>
  
  <pre><code>from bs4 import BeautifulSoup 
  import urllib2
  import re
  import pandas as pd
  
  url = 'http://www.google.com/googlebooks/uspto-patents-grants.html'
  
  site = urllib2.urlopen(url)
  html = site.read()
  soup = BeautifulSoup(html)
  soup.prettify()
  
  path = open('/Users/username/Desktop/', "wb")
  
  for name in soup.findAll('a', href=True):
      print name['href']
      linkpath = name['href']
      rq = urllib2.request(linkpath)
      res = urllib2.urlope
  </code></pre>
  
  <p>The result that I am supposed to get, is that all of the zip files are supposed to download into a specific dir. Instead, I am getting the following error: </p>
  
  <pre><code>&gt; #2015 --------------------------------------------------------------------------- AttributeError Traceback (most recent call last)
  &gt; &lt;ipython-input-13-874f34e07473&gt; in &lt;module&gt;() 17 print name['href'] 18
  &gt; linkpath = name['href'] ---&gt; 19 rq = urllib2.request(namep) 20 res =
  &gt; urllib2.urlopen(rq) 21 path.write(res.read()) AttributeError: 'module'
  &gt; object has no attribute 'request' –
  </code></pre>