Download google drive file using python in a docker image - python

I have the access token and file id of the file I need to download. After authenticating the user in a react application and using File picker API, I got both of them.
I need to pass them a python file that can download the file but without user intervention(without user permission )
Any suggestion on how to do it?
I do not have a shareable link. I have the file id and the access token after authentication. I need to download it through another application written in python.
Answers on stack overflow to download drive file using python have to do authentication using OAuth first, but in my case, I need to download the file without authentication

Related

how to download a file from sharepoint without an authentication (python)

I want to download a public file from office365 sharepoint.
the file can be downloaded and accessed without the need to authenticate.
I have seen many examples of how to download a file with authentication but I didn't find anything that does it without. how can it be done?
I'm working with python 3
and the link is looking like this:
https://XXXX.sharepoint.com/:x:/s/YYYY/ZZZZ?e=KKKK

Ask to user credentials to access Google Drive Api

I'm creating a cli tool to move file around in a user Google Drive space. I'm using Python and Google Drive Api Python SDK to do that and I've created this repo.
Now I have to run every midnight this tool to move file from a folder to another with input from user. Locally I can create credentials.son and retrieve credentials from it, generate the token.json file and use it to authenticate to Drive api. But in public CI environment, I would save my credentials in a Github Secret and give them to my tool at runtime using an option.
Can I do that?
There's some security issues?
I would publish this tool in some forums (like Python SubReddit) to get suggesstions and improvements, but before do that, I'd like to make this move file function as complete as possible.

Google drive python Script for Users-Credentials

I uploaded few files on Google-drive using my gmail account. Now my customers have to go to the drive and download those files. Files on the drive have read and write access and customers can download those files without gmail account.
I studied how i can automate this downloading process using Python. I found one wrapper PyDrive for Google-Drive Rest-api. For this API to work, i need to get credentials from the Google-Console.
I want to send that python script to user so that they can download the files but
Is it necessary to send the credientials also?
Users can't download the files without gmail account?
I can't just write a script and send to customers and they just run it without any credentials and gmail-account?

download a file from a website which requires authetication using python

I am trying to download a CSV file from a website using python 2.7. I already found some posting about how to retrieve files.
http://www.blog.pythonlibrary.org/2012/06/07/python-101-how-to-download-a-file/
How do I download a file over HTTP using Python?
However, the site that I am trying to access requires authentication: id and password. I was wondering if anyone out there might share an example of how to download a file with authentication barrier.
You can use requests module, and its documentation.

Downloading a File Protected by NTLM/SSPI Without Prompting For Credentials Using Python on Win32?

I need to download a file on a corporate Sharepoint site using CPython. Existing codebase prevents me from using Ironpython without porting the code, so .NET's WebClient library is out. I also want to download the file without prompting the user to save and without prompting the user for network credentials. I tried other libraries, but they all had short-comings:
urllib2 plus python-ntlm: requires user/pass to be provided
COM automation of Internet Explorer: requires the user to click 'Save'
subprocess using wget or cURL: couldn't get either to authenticate without requesting user/pass
I couldn't find anything in pywin32 that looks like it hooks into urllib2 or provides equivalent functionality. So, is there a way to download the file without requesting credentials and without prompting the user to click 'Save'?
I ended up finding some VB code from a Microsoft support page that uses a function from urlmon.dll I replicated it with a single line of ctypes code and it accomplished exactly what I needed it to do.
ctypes.windll.urlmon.URLDownloadToFileA(0,url,local_file_name,0,0)
url is the location of the resource (in this case, an Excel file on a Sharepoint site)
local_file_name is the local path and name of the file to be saved.
This passed credentials across the wire with no prompts.

Categories