Python Forum
Loging in users google account
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Loging in users google account
#1
Hello,

I am Stuck. So, What I am doing is:
I have python script which should run and download the contents of google drive from all the users. My code when runs it download the files from my google drive not from other users. My question is that:

I am not sure how should I login as a user in google using python. Can anyone please help.
Following are my methods which are triggered when logging in:
def get_credentials():
   		home_dir = os.path.expanduser('~')
		credential_dir = os.path.join(home_dir, '.credentials')
		if not os.path.exists(credential_dir):
			os.makedirs(credential_dir)
		credential_path = os.path.join(credential_dir,
                                   'admin-directory_v1-python-quickstart.json')

		store = Storage(credential_path)
		credentials = store.get()
		if not credentials or credentials.invalid:
			flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES)
			flow.user_agent = APPLICATION_NAME
			if flags:
				credentials = tools.run_flow(flow, store, flags)
			else: # Needed only for compatibility with Python 2.6
				credentials = tools.run(flow, store)
			print('Storing credentials to ' + credential_path)
		return credentials

credentials = get_credentials()
http = credentials.authorize(httplib2.Http())
service = discovery.build('admin', 'directory_v1', http=http)
Then I user 'service' object to create users or download contents from google drive but this service object os for my google account not for any other user. Can anyone throw some light on it?

Thanks,
Aman
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to import files in Google Collab wihout downloading them to PC and to Google Disk sveto4ka 9 3,942 Jun-03-2020, 12:40 PM
Last Post: sveto4ka
  Different results of code with local account and technical account dreyz64 7 3,704 Mar-05-2020, 11:50 AM
Last Post: dreyz64
  Any Google Voice users looking for a coding project? pydiot 3 3,897 May-31-2018, 10:11 PM
Last Post: pydiot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020