If you are using the google drive addon to serve files for another addon, you could import the cloud drive common module to your addon and then use a utility class to get the download URL.
addon.xml
xml :
<requires>
<import addon="script.module.clouddrive.common" />
</requires>
and then get the url with something like this
python:
from clouddrive.common.service.download import DownloadServiceUtil
...
...
url = DownloadServiceUtil.build_download_url(driveid, item_driveid, item_id, filename,'plugin.googledrive')
you can send anything in the
filename parameter, not necessarily the real file name.
This will generate an url pointing to the download service of the google drive addon which in turn will redirect it to the real download url from google.