Here we are going to see the Implementation of Google Drive API with Python(this blog is the next part of the last blog named How to use Google Drive API with Python).
In this series, we are going to implement different types of function which is used for communicating with google drive.
If you are new to this blog then please visit Part 1 Click here
In today’s blog, we are going to implement Google Authentication using Python.
Note:
- If you followed from the last blog then please remove quickstart.py and token.pikle file because we already implemented authentication in that with read-only mode. but now we are going to implement it with all permissions.
- Here I created program.py as the main file which calls all functions and googleDriveFunction.py for writing functions that communicate with google drive.
Step 3: Import blow showed library at the beginning of googleDriveFUnction.py and program.py file.
- If Not redirected in the browser then copy the link from the terminal(cmd) and past it into the browser and press enter.
- In the browser, if you have multiple accounts logged in then select one account. then if you get an error like the below screenshot.
- Then click on the Advanced link as shown in screenshot.
- then click on link shown in below screenshot
- Next, allow permission to access the drive as shown in the below screenshot.
- One more time confirm and allow permission as shown below screenshot.
- Next, you will see this message in the browser and in cmd(terminal) which means your authentication is successful.
Step 9: Create service using credentials
- In the program.py file, we stored credentials which is the output of the authentication function.
- use it for creating service. Write the below code in the program.py file.
- if you get output like below then service is build successfully.