title: Python getting all links from a google search result page
body: <p>i want to create a script that returns all the urls found in a page a google for example , so i create this script : (using BeautifulSoup)</p>
  
  <pre><code>import urllib2
  from BeautifulSoup import BeautifulSoup
  page = urllib2.urlopen("https://www.google.dz/search?q=see")
  soup = BeautifulSoup(page.read())
  links = soup.findAll("a")
  for link in links:
      print link["href"]
  </code></pre>
  
  <p>and it return this 403 forbidden result :</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Python27\sql\sql.py", line 3, in &lt;module&gt;
      page = urllib2.urlopen("https://www.google.dz/search?q=see")
    File "C:\Python27\lib\urllib2.py", line 126, in urlopen
      return _opener.open(url, data, timeout)
    File "C:\Python27\lib\urllib2.py", line 400, in open
      response = meth(req, response)
    File "C:\Python27\lib\urllib2.py", line 513, in http_response
      'http', request, response, code, msg, hdrs)
    File "C:\Python27\lib\urllib2.py", line 438, in error
      return self._call_chain(*args)
    File "C:\Python27\lib\urllib2.py", line 372, in _call_chain
      result = func(*args)
    File "C:\Python27\lib\urllib2.py", line 521, in http_error_default
      raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
  urllib2.HTTPError: HTTP Error 403: Forbidden
  </code></pre>
  
  <p>any idea to avoid this error or another methode to get the urls from of the search result ? </p>