Authenticating yourself to access your Google drive account through python script using Pydrive module.














































Authenticating yourself to access your Google drive account through python script using Pydrive module.



The required steps are as follows :
  1. The all important code:                                                                                                                              
    1. # To authenticate your access to G-Drive
    2. from pydrive.auth import GoogleAuth

    3. gauth = GoogleAuth()
    4. gauth.LocalWebserverAuth()# Creates local webserver and auto handles authentication.
                                                                                                                                    
  2. Basically in the above mentioned code you are importing the GoogleAuth class from pydrive.auth library.
  3. 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.
  4. 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.

Comments