The required steps are as follows :
- The all important code:
- # To authenticate your access to G-Drive
- from pydrive.auth import GoogleAuth
- gauth = GoogleAuth()
- gauth.LocalWebserverAuth()# Creates local webserver and auto handles authentication.
- Basically in the above mentioned code you are importing the GoogleAuth class from pydrive.auth library.
- In the line 4 you are creating an object gauth of GoogleAuth class and this object you are calling the LocalWebserverAuth() method of the GoogleAuth class.
- On running this code through a suitable python ide you will go through a series of webpages demanding your confirmation for providing access of your Google drive account to this script.
After choosing your required account you will be redirected to :
On providing the required access to you API script (labeled unsafe), you will be redirected to :
Just click on 'Allow' to move forward :
Again, accept the conditions asked for and click 'Allow' :
If you reach the above webpage then you are good to go with your script and now can manipulate your Google drive account with your script codes.