Download a file from GoogleDrive exportlinks
Question: Trying to download a file directly using Python and the Google Drive API
exportlinks response.

  1. Suppose I have an export link like this:

a)
[https://docs.google.com/feeds/download/documents/export/Export?id=xxxx&exportFormat=docx](https://docs.google.com/feeds/download/documents/export/Export?id=xxxx&exportFormat=docx)

  2. To download this file, I simply paste it into the browser, and the file automatically downloads to my Downloads folder.

  3. How do I do the same thing in Python?

EX:
module.download_file_using_url([https://docs.google.com/feeds/download/documents/export/Export?id=xxxx&exportFormat=docx](https://docs.google.com/feeds/download/documents/export/Export?id=xxxx&exportFormat=docx))


Answer: This is a repost of [How do I download a file over HTTP using
Python?](http://stackoverflow.com/questions/22676/how-do-i-download-a-file-
over-http-using-python)

In Python 2, use urllib2 which comes with the standard library.

import urllib2 response = urllib2.urlopen('<http://www.example.com/>') html =
response.read()

This is the most basic way to use the library, minus any error handling. You
can also do more complex stuff such as changing headers. The documentation can
be found [here](https://docs.python.org/2/library/urllib2.html).

