title: Download google docs public spreadsheet to csv with python
body: <p>I can download a CSV file from Google Docs with <code>wget</code>:</p>
  
  <pre><code>wget --no-check-certificate --output-document=locations.csv 'https://docs.google.com/spreadsheet/ccc?key=0ArM5yzzCw9IZdEdLWlpHT1FCcUpYQ2RjWmZYWmNwbXc&amp;output=csv'
  </code></pre>
  
  <p>But I can't download the same csv with Python:</p>
  
  <pre><code>import urllib2
  
  request = urllib2.Request('https://docs.google.com/spreadsheet/ccc?key=0ArM5yzzCw9IZdEdLWlpHT1FCcUpYQ2RjWmZYWmNwbXc&amp;output=csv')
  request.add_header('User-Agent', 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.13 (KHTML, like Gecko) Chrome/24.0.1284.0 Safari/537.13')
  opener = urllib2.build_opener()
  data = opener.open(request).read()
  print(data)
  </code></pre>
  
  <p>The result is the Google login page. What am I doing wrong?</p>