Useing python to download a file in google drive that is created by a google app script
Question: Ok so I've got a google script that I'm working on to help out with some stuff
and I need to be able to create a txt file and download it to my local
computer. I've figured out how to create the file as a blob and create a file
in google drive.

The problem is that I for one can't figure out how to delete the old file and
create the new file and I also can't seem to figure out how to download it
locally so I can work my python magic and create a nice looking report and
print it out. I've gone over the documentation and looked at similar questions
but I can't figure out how to actually download a file.

An example program would be great answer for me something that uses a dummy
file and downloads it, really that would be awesome.

My thoughts are that I could go back to the old file that I am trying to
download and just edit it so that way I don't have to actually delete the file
which would make it have the same ID's, meta data, and URL.

Can I use the google app script to download it directly to my computer and for
a little added info I run a Linux machine so some things are a little more
labor intensive for me while some other stuff is nice and easy. I feel like
there is an app that can run on my computer locally that stores my google
drive files locally and I could possibly just grab it from there.

Lastly a link to documentation for running the scripts natively would be
helpful as well.


Answer: use

    
    
    urllib.retrieve(httpaddressofthefile, filenametosaveitto)
    

or

    
    
    import urllib2
    response = urllib2.urlopen('http://www.wherever.com/')
    html = response.read()
    f=open(filename, 'w')
    f.write(html)
    f.close()
    

