Search code examples
pythonpython-3.xgoogle-docsgoogle-docs-api

Python3 - Download file from google docs private and public url


I want to download files from google docs urls. I want it to know how to authenticate to google to download private files also. I found this github project and it is very old, The authentication doesn't work, i can only download public files. Using urllib3 doesn't work and gives me js instead of html.

On the google docs api i've found a code that connects to google and knows only how to get recent docs(of the authenticated user) and things like that.

I need a code (prefer in pyhton3) that knows how to authenticate and download urls straight from google docs.


Solution

  • The user has to authenticate the app, which will most likely call a browser which will bring up the user consent screen. You can use the official Python Quickstart to handle this.

    As for downloading the docs, the documentation also discusses this (Download Files) with some code snippets for python you can use.